From 426bc7fb4fcdd7e28544f8fb29854316a1784850 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 16 Mar 2016 15:41:13 -0700 Subject: Fix "tail -f single_file". TT.file_no was being incorrectly calculated as 0 when tail -f was passed a single argument. --- toys/posix/tail.c | 4 ++-- 1 file 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); } -- cgit v1.2.3