mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] mkdir command: do not fail with -p and directory already exists
Date: Fri, 11 Nov 2011 16:21:44 +0100	[thread overview]
Message-ID: <1321024905-17030-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1321024905-17030-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-11-11 15:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11 15:21 small fixes Sascha Hauer
2011-11-11 15:21 ` Sascha Hauer [this message]
2011-11-11 15:21 ` [PATCH 2/2] export: do not fail on already exported variable Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321024905-17030-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox