commit aa7f57eed805adb09e9c59c8ea841870e8206b81
parent ca00b8e283a8a327c17521d921fc41a449c39a42
Author: Conrad Parker <conrad@metadecks.org>
Date: Fri, 2 Sep 2016 12:26:39 +1000
Merge pull request #17 from mptre/master
Fix segfault when stdin is empty
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xsel.c b/xsel.c
@@ -949,7 +949,7 @@ initialise_read (unsigned char * read_buffer)
int insize = in_statbuf.st_blksize;
unsigned char * new_buffer = NULL;
- if (S_ISREG (in_statbuf.st_mode)) {
+ if (S_ISREG (in_statbuf.st_mode) && in_statbuf.st_size > 0) {
current_alloc += in_statbuf.st_size;
} else {
current_alloc += insize;