diff options
author | Jim Meyering <jim@meyering.net> | 1999-07-31 09:21:32 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-07-31 09:21:32 +0000 |
commit | ca47081c5bc7759a88eaf9eebf3ae163c0aed2f9 (patch) | |
tree | e26c64a256cd0793d15c9a5a56b898507842f6a1 /src | |
parent | 5e8ad5a5773b5d2e2c1d266e6287263b3ea225a5 (diff) | |
download | coreutils-ca47081c5bc7759a88eaf9eebf3ae163c0aed2f9.tar.xz |
(tail_forever): Don't call kill if pid is 0.
Detect when `writer_is_dead' also when the writer is some other user.
From Karl Heuer.
(parse_options): Warn if --pid=PID is used without -f.
Diffstat (limited to 'src')
-rw-r--r-- | src/tail.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tail.c b/src/tail.c index b8109dd8a..e6f9b422c 100644 --- a/src/tail.c +++ b/src/tail.c @@ -922,7 +922,12 @@ tail_forever (struct File_spec *f, int nfiles) /* Once the writer is dead, read the files once more to avoid a race condition. */ - writer_is_dead = (kill (pid, 0) != 0); + writer_is_dead = (pid != 0 + && kill (pid, 0) != 0 + /* Handle the case in which you cannot send a + signal to the writer, so kill fails and sets + errno to EPERM. */ + && errno != EPERM); } } } @@ -1426,6 +1431,10 @@ parse_options (int argc, char **argv, if (reopen_inaccessible_files && follow_mode != Follow_name) error (0, 0, _("warning: --retry is useful only when following by name")); + + if (pid && !forever) + error (0, 0, + _("warning: PID ignored; --pid=PID is useful only when following")); } int |