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 <[email protected]>
---
 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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to