From cde598f22ea3460d411fb9a1e5ec4d24bf3882d9 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Thu, 9 Aug 2018 10:33:11 +0200 Subject: libfile: open_and_lseek: don't imply O_RDONLY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are several users that pass O_RDWR or O_WRONLY in mode to open_and_lseek() and use the resulting file descriptor for writing. This is no real issue becauce O_RDONLY is 0 and so can be dropped without any side effects. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- lib/libfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libfile.c b/lib/libfile.c index d22519b8f4..83c6399a5b 100644 --- a/lib/libfile.c +++ b/lib/libfile.c @@ -501,7 +501,7 @@ int open_and_lseek(const char *filename, int mode, loff_t pos) { int fd, ret; - fd = open(filename, mode | O_RDONLY); + fd = open(filename, mode); if (fd < 0) { perror("open"); return fd; -- cgit v1.2.3