diff options
author | Giuseppe Scrivano <gscrivano@gnu.org> | 2009-07-02 23:38:46 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-07-03 17:52:30 +0200 |
commit | d9f83f9a603a2f5ecdc13bbe65e22aba49d43d66 (patch) | |
tree | ab3cb47bb125147d0bed8d56c693b9d0456f0453 /src/tail.c | |
parent | 66ac50e723096b7350b2a4be004c71b6b6ccc612 (diff) | |
download | coreutils-d9f83f9a603a2f5ecdc13bbe65e22aba49d43d66.tar.xz |
tail: avoid an inotify portability problem in kernels prior to 2.6.21
* src/tail.c (tail_forever_inotify): Handle the special case in which
an old inotify watcher returns 0. Affects kernels in [2.6.13, 2.6.21).
Diffstat (limited to 'src/tail.c')
-rw-r--r-- | src/tail.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tail.c b/src/tail.c index 89c43b827..b3ebba9d6 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1259,8 +1259,9 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files) evbuf_off = 0; /* For kernels prior to 2.6.21, read returns 0 when the buffer - is too small. FIXME: handle that. */ - if (len == SAFE_READ_ERROR && errno == EINVAL && max_realloc--) + is too small. */ + if ((len == 0 || (len == SAFE_READ_ERROR && errno == EINVAL)) + && max_realloc--) { len = 0; evlen *= 2; @@ -1268,7 +1269,7 @@ tail_forever_inotify (int wd, struct File_spec *f, int n_files) continue; } - if (len == SAFE_READ_ERROR) + if (len == 0 || len == SAFE_READ_ERROR) error (EXIT_FAILURE, errno, _("error reading inotify event")); } |