aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-01-09 12:54:04 -0800
committerRob Landley <rob@landley.net>2016-01-10 23:01:28 -0600
commit5f58880c15ce3434c0eac8959ea1e07a91b0dc03 (patch)
treec04daa09dc36fdcdd8a10dc8556b01b1e33198ed
parentc55d30d85f1332f5022132c119ecfa3f2f16f4c5 (diff)
downloadtoybox-5f58880c15ce3434c0eac8959ea1e07a91b0dc03.tar.gz
Fix tail -f /does/not/exist.
Exit immediately if we don't actually have anything to -f --- it's -f's big brother -F that retries by name rather than by fd.
-rw-r--r--toys/posix/tail.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/tail.c b/toys/posix/tail.c
index a00bfa0c..d1c62508 100644
--- a/toys/posix/tail.c
+++ b/toys/posix/tail.c
@@ -245,7 +245,7 @@ void tail_main(void)
loopfiles_rw(args, O_RDONLY|(O_CLOEXEC*!(toys.optflags&FLAG_f)),
0, 0, do_tail);
- if (toys.optflags & FLAG_f) {
+ if ((toys.optflags & FLAG_f) && TT.file_no) {
int len, last_fd = TT.files[(TT.file_no-1)*2], i, fd;
struct inotify_event ev;