diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2019-07-09 00:22:53 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-07-09 11:38:10 +0200 |
commit | aa8a42ac0a259187c88e8a4aca5f3d4f4f4b753a (patch) | |
tree | 5537c2f3010ef8f7c78b0380cfbc1b64cbced9a4 /lib | |
parent | e7c33540d0c092c28b227d4b7602cef8ab203ef3 (diff) | |
download | barebox-aa8a42ac0a259187c88e8a4aca5f3d4f4f4b753a.tar.gz barebox-aa8a42ac0a259187c88e8a4aca5f3d4f4f4b753a.tar.xz |
lib: Add missing arguments to memcpy_parse_options()
Memcpy use-case differs from that of memcmp in default access type and
destination file mode. This was missed in original commit that
introduced memcpy_parse_options(). Add said parameters to
memcpy_parse_options(), so the can be correctly specified depending on
the use-case.
Fixes: ddf4cca339 ("commands: Introduce memcpy_parse_options()")
Reported-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/misc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/misc.c b/lib/misc.c index 18153bb4dc..7add1fe3b4 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -173,10 +173,11 @@ int mem_parse_options(int argc, char *argv[], char *optstr, int *mode, } int memcpy_parse_options(int argc, char *argv[], int *sourcefd, - int *destfd, loff_t *count) + int *destfd, loff_t *count, + int rwsize, int destmode) { loff_t dest, src; - int mode = 0; + int mode = rwsize; char *sourcefile = NULL; char *destfile = NULL; struct stat statbuf; @@ -212,7 +213,7 @@ int memcpy_parse_options(int argc, char *argv[], int *sourcefd, if (*sourcefd < 0) return -1; - *destfd = open_and_lseek(destfile, O_WRONLY | O_CREAT | mode, dest); + *destfd = open_and_lseek(destfile, mode | destmode, dest); if (*destfd < 0) { close(*sourcefd); return -1; |