diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-10-13 10:03:16 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-11-04 09:31:02 +0100 |
commit | ed395e4df1ed4188cbb52870b8ad4b677be4cca0 (patch) | |
tree | 91a31f1413f371211d4b963dbbb4458e48769c9e /include/fcntl.h | |
parent | e5b991832926599892645668791870fd17e196e3 (diff) | |
download | barebox-ed395e4df1ed4188cbb52870b8ad4b677be4cca0.tar.gz barebox-ed395e4df1ed4188cbb52870b8ad4b677be4cca0.tar.xz |
fcntl: Fix O_CREAT clashing with O_RWSIZE_8
O_CREAT and O_RWSIZE_8 are both defined as 0100. Fix this by moving the
O_RWSIZE_* flags to unused bits.
This bug leads to incomplete writes when the destination file is created
and mem_write is involved, for example with the memcpy command:
memcpy -s /some/file -d /dev/ram0 0 0 10
In this case only 8 bytes will be copied and it will be done using 8
byte accesses which may not work properly if the destination is not
sufficiently aligned, i.e.:
memcpy -s /some/file -d /dev/ram0 0 1 8
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Diffstat (limited to 'include/fcntl.h')
-rw-r--r-- | include/fcntl.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/fcntl.h b/include/fcntl.h index 501b415035..12f370a418 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -17,12 +17,12 @@ #define O_NOFOLLOW 00400000 /* don't follow links */ /* barebox additional flags */ -#define O_RWSIZE_MASK 00000170 -#define O_RWSIZE_SHIFT 3 -#define O_RWSIZE_1 00000010 -#define O_RWSIZE_2 00000020 -#define O_RWSIZE_4 00000040 -#define O_RWSIZE_8 00000100 +#define O_RWSIZE_MASK 017000000 +#define O_RWSIZE_SHIFT 18 +#define O_RWSIZE_1 001000000 +#define O_RWSIZE_2 002000000 +#define O_RWSIZE_4 004000000 +#define O_RWSIZE_8 010000000 #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get close_on_exec */ |