From aa8a42ac0a259187c88e8a4aca5f3d4f4f4b753a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 9 Jul 2019 00:22:53 -0700 Subject: 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 Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/memcmp.c | 3 ++- commands/memcpy.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'commands') diff --git a/commands/memcmp.c b/commands/memcmp.c index d1c4f5205d..76fbe078f0 100644 --- a/commands/memcmp.c +++ b/commands/memcmp.c @@ -42,7 +42,8 @@ static int do_memcmp(int argc, char *argv[]) int ret = 1; int offset = 0; - if (memcpy_parse_options(argc, argv, &sourcefd, &destfd, &count) < 0) + if (memcpy_parse_options(argc, argv, &sourcefd, &destfd, &count, + O_RWSIZE_1, O_RDONLY) < 0) return 1; buf = xmalloc(RW_BUF_SIZE + RW_BUF_SIZE); diff --git a/commands/memcpy.c b/commands/memcpy.c index 5f0047f87c..b2cea8c09d 100644 --- a/commands/memcpy.c +++ b/commands/memcpy.c @@ -41,7 +41,8 @@ static int do_memcpy(int argc, char *argv[]) int ret = 0; char *buf; - if (memcpy_parse_options(argc, argv, &sourcefd, &destfd, &count) < 0) + if (memcpy_parse_options(argc, argv, &sourcefd, &destfd, &count, + 0, O_WRONLY | O_CREAT) < 0) return 1; buf = xmalloc(RW_BUF_SIZE); -- cgit v1.2.3