summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2017-01-31 20:10:02 -0800
committerPádraig Brady <P@draigBrady.com>2017-02-08 14:40:22 -0800
commita520942efadbd0f86759f9bcb428ec0a83ed56e4 (patch)
treef0355afe1876e843ecd03340b2609859ca8eb3a6 /src
parent2c64bc87293bd8bf369b8dbd487a793ea9803775 (diff)
downloadcoreutils-a520942efadbd0f86759f9bcb428ec0a83ed56e4.tar.xz
tail: fix erroneous status about 'giving up' on file
* src/tail.c (recheck): Set f->ignore before we use it to show the appropriate error. * tests/tail-2/retry.sh: Ensure the "giving up" message is not presented.
Diffstat (limited to 'src')
-rw-r--r--src/tail.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tail.c b/src/tail.c
index 3023dd4df..0c9c3e882 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -981,8 +981,7 @@ recheck (struct File_spec *f, bool blocking)
ok = false;
f->errnum = -1;
f->tailable = false;
- if (! (reopen_inaccessible_files && follow_mode == Follow_name))
- f->ignore = true;
+ f->ignore = ! (reopen_inaccessible_files && follow_mode == Follow_name);
if (was_tailable || prev_errnum != f->errnum)
error (0, 0, _("%s has been replaced with an untailable file%s"),
quoteaf (pretty_name (f)),
@@ -1940,6 +1939,7 @@ tail_file (struct File_spec *f, uintmax_t n_units)
ok = false;
f->errnum = -1;
f->tailable = false;
+ f->ignore = ! reopen_inaccessible_files;
error (0, 0, _("%s: cannot follow end of this type of file%s"),
quotef (pretty_name (f)),
f->ignore ? _("; giving up on this name") : "");
@@ -1947,8 +1947,7 @@ tail_file (struct File_spec *f, uintmax_t n_units)
if (!ok)
{
- f->ignore = ! (reopen_inaccessible_files
- && follow_mode == Follow_name);
+ f->ignore = ! reopen_inaccessible_files;
close_fd (fd, pretty_name (f));
f->fd = -1;
}