diff options
Diffstat (limited to 'coreutils/tail.c')
-rw-r--r-- | coreutils/tail.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/coreutils/tail.c b/coreutils/tail.c index d49539916..f330ab1a1 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -81,17 +81,14 @@ static ssize_t tail_read(int fd, char *buf, size_t count) | |||
81 | ssize_t r; | 81 | ssize_t r; |
82 | off_t current,end; | 82 | off_t current,end; |
83 | struct stat sbuf; | 83 | struct stat sbuf; |
84 | int ret; | ||
85 | 84 | ||
86 | end = current = lseek (fd, 0, SEEK_CUR); | 85 | end = current = lseek(fd, 0, SEEK_CUR); |
87 | if (!fstat(fd, &sbuf)){ | 86 | if (!fstat(fd, &sbuf)) |
88 | end = sbuf.st_size; | 87 | end = sbuf.st_size; |
89 | } | 88 | if (end < current) |
90 | if ( end < current) { | ||
91 | lseek(fd, 0, SEEK_SET); | 89 | lseek(fd, 0, SEEK_SET); |
92 | } else { | 90 | else |
93 | lseek(fd, current, SEEK_SET); | 91 | lseek(fd, current, SEEK_SET); |
94 | } | ||
95 | if ((r = safe_read(fd, buf, count)) < 0) { | 92 | if ((r = safe_read(fd, buf, count)) < 0) { |
96 | bb_perror_msg("read"); | 93 | bb_perror_msg("read"); |
97 | status = EXIT_FAILURE; | 94 | status = EXIT_FAILURE; |