diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2018-08-09 10:33:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-08-10 08:21:46 +0200 |
commit | 8b8dcd3ea6b1fa82be3092ae70750258f1bfaca6 (patch) | |
tree | 9c23dcc986b898db6fd5aab87993a6de1a9d2e26 /commands/memset.c | |
parent | 686d35f88db5779786b862205a503cffdb1a5bde (diff) | |
download | barebox-8b8dcd3ea6b1fa82be3092ae70750258f1bfaca6.tar.gz barebox-8b8dcd3ea6b1fa82be3092ae70750258f1bfaca6.tar.xz |
commands: teach commands that write to files to also create them
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 <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/memset.c')
-rw-r--r-- | commands/memset.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commands/memset.c b/commands/memset.c index f871e07c95..f99bf86c04 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; |