diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2018-08-09 10:33:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-08-10 08:10:26 +0200 |
commit | cde598f22ea3460d411fb9a1e5ec4d24bf3882d9 (patch) | |
tree | d9890a33f8f2d5e765c4b66c5dc87107c2ca2684 /lib | |
parent | 1df07fbcdfce7852cf97a0397b20b586248e1226 (diff) | |
download | barebox-cde598f22ea3460d411fb9a1e5ec4d24bf3882d9.tar.gz barebox-cde598f22ea3460d411fb9a1e5ec4d24bf3882d9.tar.xz |
libfile: open_and_lseek: don't imply O_RDONLY
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@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfile.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |