From 5f58880c15ce3434c0eac8959ea1e07a91b0dc03 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sat, 9 Jan 2016 12:54:04 -0800 Subject: 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. --- toys/posix/tail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3