From: Jim Meyering Date: Sat, 18 Nov 2000 13:49:44 +0000 (+0000) Subject: (main): When failing to create a directory, give only X-Git-Tag: FILEUTILS-4_0_33~78 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bbc00b1470c7274195b28497d56fe5bc823af29;p=thirdparty%2Fcoreutils.git (main): When failing to create a directory, give only one diagnostic, not two. Reported by Volker Borchert. --- diff --git a/src/mkdir.c b/src/mkdir.c index c597f35df3..c9d03eddd4 100644 --- a/src/mkdir.c +++ b/src/mkdir.c @@ -169,11 +169,15 @@ main (int argc, char **argv) int t_errno; fail = make_dir (dir, dir, newmode, &dir_created); t_errno = errno; - /* If make_dir `succeeds' because the directory already exists, - then fail unless --parents (-p) was specified. */ - if (fail || - (!create_parents && !dir_created && (t_errno = EEXIST))) + if (fail) { + /* make_dir already gave a diagnostic. */ + } + else if (!create_parents && !dir_created && (t_errno = EEXIST)) + { + /* make_dir `succeeds' when DIR already exists. + In that case, mkdir must fail, unless --parents (-p) + was specified. */ error (0, t_errno, _("cannot create directory %s"), quote (dir)); fail = 1;