diff options
author | Jim Meyering <jim@meyering.net> | 2000-11-18 13:49:44 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-11-18 13:49:44 +0000 |
commit | 8bbc00b1470c7274195b28497d56fe5bc823af29 (patch) | |
tree | 87fcc229b4266d3c1674de9fde44e2ee98b7772d /src | |
parent | 9ca70467e90f86f64d37b3d94081f980017a8f22 (diff) | |
download | coreutils-8bbc00b1470c7274195b28497d56fe5bc823af29.tar.xz |
(main): When failing to create a directory, give only
one diagnostic, not two. Reported by Volker Borchert.
Diffstat (limited to 'src')
-rw-r--r-- | src/mkdir.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mkdir.c b/src/mkdir.c index c597f35df..c9d03eddd 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; |