This allows to use the adapted commands on non-existing files which
failed before with

        open: No such file or directory

Signed-off-by: Uwe Kleine-König <[email protected]>
---
 commands/memset.c | 2 +-
 commands/mm.c     | 2 +-
 commands/mw.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/commands/memset.c b/commands/memset.c
index f871e07c9523..f99bf86c0415 100644
--- a/commands/memset.c
+++ b/commands/memset.c
@@ -56,7 +56,7 @@ static int do_memset(int argc, char *argv[])
        c = strtoull_suffix(argv[optind + 1], NULL, 0);
        n = strtoull_suffix(argv[optind + 2], NULL, 0);
 
-       fd = open_and_lseek(file, mode | O_WRONLY, s);
+       fd = open_and_lseek(file, mode | O_WRONLY | O_CREAT, s);
        if (fd < 0)
                return 1;
 
diff --git a/commands/mm.c b/commands/mm.c
index 6d2a88789299..c7f62fca54bb 100644
--- a/commands/mm.c
+++ b/commands/mm.c
@@ -53,7 +53,7 @@ static int do_mem_mm(int argc, char *argv[])
        value = simple_strtoull(argv[optind++], NULL, 0);
        mask = simple_strtoull(argv[optind++], NULL, 0);
 
-       fd = open_and_lseek(filename, mode | O_RDWR, adr);
+       fd = open_and_lseek(filename, mode | O_RDWR | O_CREAT, adr);
        if (fd < 0)
                return 1;
 
diff --git a/commands/mw.c b/commands/mw.c
index 7ff589abb1d4..2912997a31df 100644
--- a/commands/mw.c
+++ b/commands/mw.c
@@ -52,7 +52,7 @@ static int do_mem_mw(int argc, char *argv[])
 
        adr = strtoull_suffix(argv[optind++], NULL, 0);
 
-       fd = open_and_lseek(filename, mode | O_WRONLY, adr);
+       fd = open_and_lseek(filename, mode | O_WRONLY | O_CREAT, adr);
        if (fd < 0)
                return 1;
 
-- 
2.18.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to