diff options
author | Elliott Hughes <enh@google.com> | 2021-06-30 16:38:42 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-07-01 10:45:56 -0500 |
commit | 933f238bd1dfd8931fa3cc60f61aea19802daefd (patch) | |
tree | 782a94d17790b5bfa20ee71e3f2689a75ebfcbde /lib | |
parent | df7bfd2e1e7906596f5ac2ef4cdd51c7f1d918b9 (diff) | |
download | toybox-933f238bd1dfd8931fa3cc60f61aea19802daefd.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/portability.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |