From a234fe9966e361cc850871dc6ffa4d598817ebbe Mon Sep 17 00:00:00 2001 From: ps Date: Fri, 26 Aug 2005 08:15:57 +0000 Subject: Unbreak tail -f on non-local filesystems. --- usr.bin/tail/forward.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'usr.bin') diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index 1a3c658..e8f3aaf 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); static const char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif +#include +#include #include #include #include @@ -267,6 +269,7 @@ set_events(file_info_t *files) int i, n = 0; file_info_t *file; struct timespec ts; + struct statfs sf; ts.tv_sec = 0; ts.tv_nsec = 0; @@ -275,6 +278,13 @@ set_events(file_info_t *files) for (i = 0, file = files; i < no_files; i++, file++) { if (! file->fp) continue; + + if (fstatfs(fileno(file->fp), &sf) == 0 && + (sf.f_flags & MNT_LOCAL) == 0) { + action = USE_SLEEP; + return; + } + if (Fflag && fileno(file->fp) != STDIN_FILENO) { EV_SET(&ev[n], fileno(file->fp), EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, -- cgit v1.1