busybox: update to 1.19.2 (thanks to Peter Wagner)
[openwrt/openwrt.git] / package / busybox / patches / 000-upstream-tail.patch
1 --- a/coreutils/tail.c
2 +++ b/coreutils/tail.c
3 @@ -203,7 +203,7 @@ int tail_main(int argc, char **argv)
4 int fd = fds[i];
5
6 if (ENABLE_FEATURE_FANCY_TAIL && fd < 0)
7 - continue; /* may happen with -E */
8 + continue; /* may happen with -F */
9
10 if (nfiles > header_threshhold) {
11 tail_xprint_header(fmt, argv[i]);
12 @@ -252,14 +252,14 @@ int tail_main(int argc, char **argv)
13 * Used only by +N code ("start from Nth", 1-based): */
14 seen = 1;
15 newlines_seen = 0;
16 - while ((nread = tail_read(fd, buf, tailbufsize-taillen)) > 0) {
17 + while ((nread = tail_read(fd, buf, tailbufsize - taillen)) > 0) {
18 if (G.from_top) {
19 int nwrite = nread;
20 if (seen < count) {
21 /* We need to skip a few more bytes/lines */
22 if (COUNT_BYTES) {
23 nwrite -= (count - seen);
24 - seen = count;
25 + seen += nread;
26 } else {
27 char *s = buf;
28 do {
29 --- a/testsuite/tail.tests
30 +++ b/testsuite/tail.tests
31 @@ -14,4 +14,12 @@ testing "tail: +N with N > file length"
32 "0\n" \
33 "" "qw"
34
35 +testing "tail: -c +N with largish N" \
36 + "
37 + dd if=/dev/zero bs=16k count=1 2>/dev/null | tail -c +8200 | wc -c;
38 + dd if=/dev/zero bs=16k count=1 2>/dev/null | tail -c +8208 | wc -c;
39 + " \
40 + "8185\n8177\n" \
41 + "" ""
42 +
43 exit $FAILCOUNT