diff options
author | Josh Gao <jmgao@google.com> | 2016-03-16 15:41:13 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-03-18 12:10:25 -0500 |
commit | 426bc7fb4fcdd7e28544f8fb29854316a1784850 (patch) | |
tree | ac2b51f27ef36df87288749fe649dfaab35bbd36 | |
parent | 0ec95b7c2e20cd7be33bae6adba20bf89c5f3e86 (diff) | |
download | toybox-426bc7fb4fcdd7e28544f8fb29854316a1784850.tar.gz |
Fix "tail -f single_file".
TT.file_no was being incorrectly calculated as 0 when tail -f was passed
a single argument.
-rw-r--r-- | toys/posix/tail.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/tail.c b/toys/posix/tail.c index d1c62508..bf25a149 100644 --- a/toys/posix/tail.c +++ b/toys/posix/tail.c @@ -136,7 +136,7 @@ static void do_tail(int fd, char *name) int linepop = 1; if (toys.optflags & FLAG_f) { - int f = TT.file_no*2; + int f = (TT.file_no++)*2; char *s = name; if (!fd) sprintf(s = toybuf, "/proc/self/fd/%d", fd); @@ -146,7 +146,7 @@ static void do_tail(int fd, char *name) } if (toys.optc > 1) { - if (TT.file_no++) xputc('\n'); + if (TT.file_no) xputc('\n'); xprintf("==> %s <==\n", name); } |