1 Index: busybox-1.7.2/coreutils/tail.c
2 ===================================================================
3 --- busybox-1.7.2.orig/coreutils/tail.c 2007-10-30 15:34:59.000000000 -0500
4 +++ busybox-1.7.2/coreutils/tail.c 2007-10-30 15:35:06.000000000 -0500
6 static ssize_t tail_read(int fd, char *buf, size_t count)
13 - end = current = lseek(fd, 0, SEEK_CUR);
14 - if (!fstat(fd, &sbuf))
16 - lseek(fd, end < current ? 0 : current, SEEK_SET);
17 + /* (A good comment is missing here) */
18 + current = lseek(fd, 0, SEEK_CUR);
19 + /* /proc files report zero st_size, don't lseek them. */
20 + if (fstat(fd, &sbuf) == 0 && sbuf.st_size)
21 + if (sbuf.st_size < current)
22 + lseek(fd, 0, SEEK_SET);
24 r = safe_read(fd, buf, count);
26 bb_perror_msg(bb_msg_read_error);
29 static unsigned eat_num(const char *p)
32 - else if (*p == '+') { p++; G.status = EXIT_FAILURE; }
35 + else if (*p == '+') {
37 + G.status = EXIT_FAILURE;
39 return xatou_sfx(p, tail_suffixes);