summaryrefslogtreecommitdiff
path: root/busybox/coreutils
diff options
context:
space:
mode:
authorRob Landley2005-08-13 00:46:00 +0000
committerRob Landley2005-08-13 00:46:00 +0000
commit6022fc8723c4bfaf055011db33f69565fa0c82b1 (patch)
treef37b984e249247f2bdf6679e8b01158afcb56e16 /busybox/coreutils
parentfc455b2101edbf97331384831de2989ce9cdb731 (diff)
downloadbusybox-6022fc8723c4bfaf055011db33f69565fa0c82b1.zip
busybox-6022fc8723c4bfaf055011db33f69565fa0c82b1.tar.gz
Backport:
10882 tar fix 10884, 10920, 11128 tail fixes 10885 tftp -g fix 10900 dpkg fix (script support) And I guess 10918 isn't relevant?
Diffstat (limited to 'busybox/coreutils')
-rw-r--r--busybox/coreutils/tail.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/busybox/coreutils/tail.c b/busybox/coreutils/tail.c
index e3f89d2..1db1e2b 100644
--- a/busybox/coreutils/tail.c
+++ b/busybox/coreutils/tail.c
@@ -79,7 +79,13 @@ static void tail_xbb_full_write(const char *buf, size_t len)
static ssize_t tail_read(int fd, char *buf, size_t count)
{
ssize_t r;
+ off_t current,end;
+ struct stat sbuf;
+ end = current = lseek(fd, 0, SEEK_CUR);
+ if (!fstat(fd, &sbuf))
+ end = sbuf.st_size;
+ lseek(fd, end < current ? 0 : current, SEEK_SET);
if ((r = safe_read(fd, buf, count)) < 0) {
bb_perror_msg("read");
status = EXIT_FAILURE;