aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-01-13 16:37:06 +0000
committerPádraig Brady <P@draigBrady.com>2025-01-13 17:24:16 +0000
commit527d331af451f809f87fac846a8bd5a93ac4efb0 (patch)
treec3a6cd0c05eae4fb5e740717eb05de6fa62d98e3
parentbuild: update to latest gnulib (diff)
downloadcoreutils-527d331af451f809f87fac846a8bd5a93ac4efb0.tar.gz
coreutils-527d331af451f809f87fac846a8bd5a93ac4efb0.zip
tail: fix regression in open() flags used
* src/tail.c (tail_file): Fix precedence issue introduced in commit v9.5-231-g177fcec66 so that we pass correct flags to open(). Effectively this meant we would have dropped the O_BINARY flag on windows, since O_RDONLY is generally 0. Issue spotted by coverity.
-rw-r--r--src/tail.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/tail.c b/src/tail.c
index 30207e288..1ed1c4fab 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -2020,8 +2020,7 @@ tail_file (struct File_spec *f, uintmax_t n_files, uintmax_t n_units)
xset_binary_mode (STDIN_FILENO, O_BINARY);
}
else
- fd = open (f->name, O_RDONLY | O_BINARY
- | nonblocking ? O_NONBLOCK : 0);
+ fd = open (f->name, O_RDONLY | O_BINARY | (nonblocking ? O_NONBLOCK : 0));
f->tailable = !(reopen_inaccessible_files && fd == -1);