1 diff -urN busybox-1.7.2/coreutils/tail.c busybox-1.7.2-tail/coreutils/tail.c
2 --- busybox-1.7.2/coreutils/tail.c 2007-09-03 12:48:40.000000000 +0100
3 +++ busybox-1.7.2-tail/coreutils/tail.c 2007-10-02 11:16:28.000000000 +0100
5 static ssize_t tail_read(int fd, char *buf, size_t count)
12 - end = current = lseek(fd, 0, SEEK_CUR);
13 - if (!fstat(fd, &sbuf))
15 - lseek(fd, end < current ? 0 : current, SEEK_SET);
16 + /* (A good comment is missing here) */
17 + current = lseek(fd, 0, SEEK_CUR);
18 + /* /proc files report zero st_size, don't lseek them. */
19 + if (fstat(fd, &sbuf) == 0 && sbuf.st_size)
20 + if (sbuf.st_size < current)
21 + lseek(fd, 0, SEEK_SET);
23 r = safe_read(fd, buf, count);
25 bb_perror_msg(bb_msg_read_error);
28 static unsigned eat_num(const char *p)
31 - else if (*p == '+') { p++; G.status = EXIT_FAILURE; }
34 + else if (*p == '+') {
36 + G.status = EXIT_FAILURE;
38 return xatou_sfx(p, tail_suffixes);