mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-19 10:15:48 +02:00
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).
This commit is contained in:
committed by
Jim Meyering
parent
66ac50e723
commit
d9f83f9a60
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user