]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tail: fix tail -f failure when inotify used
authorPádraig Brady <P@draigBrady.com>
Wed, 12 Aug 2009 18:01:56 +0000 (19:01 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 13 Aug 2009 15:09:27 +0000 (16:09 +0100)
* src/tail.c (tail_forever_inotify): Remove the redundant and
incorrect error check of the return from inotify_add_watch().
Also initialize the wd member of each File_spec to an invalid value.
Reported by C de-Avillez.

src/tail.c

index 3c8f425caa2e8bc4f4e6132ac62954adefcbf857..6f837062582760c4fb7877537ab6aeebd959db60 100644 (file)
@@ -1193,7 +1193,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
           if (evlen < fnlen)
             evlen = fnlen;
 
-          f[i].wd = 0;
+          f[i].wd = -1;
 
           if (follow_mode == Follow_name)
             {
@@ -1231,8 +1231,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
           if (hash_insert (wd_table, &(f[i])) == NULL)
             xalloc_die ();
 
-          if (follow_mode == Follow_name || f[i].wd)
-            found_watchable = true;
+          found_watchable = true;
         }
     }