coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tail: fix regression in open() flags used


From: Pádraig Brady
Subject: [PATCH] tail: fix regression in open() flags used
Date: Mon, 13 Jan 2025 17:21:04 +0000

* src/tail.c (tail_file): Fix precedence 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.
---
 src/tail.c | 3 +--
 1 file changed, 1 insertion(+), 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);
 
-- 
2.47.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]