[PATCH 1/2] mkdir command: do not fail with -p and directory already exists
Sascha Hauer
s.hauer at pengutronix.de
Fri Nov 11 10:21:44 EST 2011
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
commands/mkdir.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/commands/mkdir.c b/commands/mkdir.c
index b66795b..45e7408 100644
--- a/commands/mkdir.c
+++ b/commands/mkdir.c
@@ -45,10 +45,13 @@ static int do_mkdir(struct command *cmdtp, int argc, char *argv[])
return COMMAND_ERROR_USAGE;
while (optind < argc) {
- if (parent)
+ if (parent) {
ret = make_directory(argv[optind]);
- else
+ if (ret == -EEXIST)
+ ret = 0;
+ } else {
ret = mkdir(argv[optind], 0);
+ }
if (ret) {
printf("could not create %s: %s\n", argv[optind], errno_str());
return 1;
--
1.7.7.1
More information about the barebox
mailing list