[PATCH 1/3] libfile: open_and_lseek: don't imply O_RDONLY

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

 



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 <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 lib/libfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libfile.c b/lib/libfile.c
index d22519b8f4bb..83c6399a5b39 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;
-- 
2.18.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux