From 933f238bd1dfd8931fa3cc60f61aea19802daefd Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 30 Jun 2021 16:38:42 -0700 Subject: tail: implement -F (and its companion -s). (Based on someone else's patch.) Implementing -F with inotify is a lot more work (including more portability shims for macOS), so this is a simpler polling implementation. Also fix my earlier mistake where xnotify_add() wasn't actually an 'x' function that exits on failure. --- lib/portability.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/portability.c b/lib/portability.c index 6118d0f2..f97af60e 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -211,7 +211,7 @@ int xnotify_add(struct xnotify *not, int fd, char *path) if (not->count == not->max) error_exit("xnotify_add overflow"); EV_SET(&event, fd, EVFILT_VNODE, EV_ADD|EV_CLEAR, NOTE_WRITE, 0, NULL); if (kevent(not->kq, &event, 1, NULL, 0, NULL) == -1 || event.flags & EV_ERROR) - return -1; + error_exit("xnotify_add failed on %s", path); not->paths[not->count] = path; not->fds[not->count++] = fd; @@ -257,7 +257,7 @@ int xnotify_add(struct xnotify *not, int fd, char *path) if (not->max == not->count) error_exit("xnotify_add overflow"); if ((not->fds[i] = inotify_add_watch(not->kq, path, IN_MODIFY))==-1) - return -1; + perror_exit("xnotify_add failed on %s", path); not->fds[i+1] = fd; not->paths[not->count++] = path; -- cgit v1.2.3