diff options
-rw-r--r-- | inotail.c | 3 | ||||
-rw-r--r-- | inotail.h | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -565,7 +565,8 @@ static int tail_file(struct file_struct *f, unsigned long n_units, mode_t mode, } f->size = finfo.st_size; - f->blksize = finfo.st_blksize; /* TODO: Can this value be 0? */ + if (likely(finfo.st_blksize > 0)) + f->blksize = finfo.st_blksize; if (mode == M_LINES) offset = lines_to_offset(f, n_units); @@ -38,8 +38,10 @@ struct file_struct { #define is_digit(c) ((c) >= '0' && (c) <= '9') #ifdef __GNUC__ +# define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0) #else +# define likely(x) (x) # define unlikely(x) (x) #endif /* __GNUC__ */ |