mkdir: Fail on EEXIST with no -p flag
mkdir without the -p flag should only exit success if it actually made the directory.
This commit is contained in:
parent
830ca05c25
commit
e795946971
7
mkdir.c
7
mkdir.c
@ -38,10 +38,9 @@ main(int argc, char *argv[])
|
||||
if (pflag) {
|
||||
if (mkdirp(*argv) < 0)
|
||||
ret = 1;
|
||||
} else if (mkdir(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0 &&
|
||||
errno != EEXIST) {
|
||||
weprintf("mkdir %s:", *argv);
|
||||
ret = 1;
|
||||
} else if (mkdir(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
|
||||
weprintf("mkdir %s:", *argv);
|
||||
ret = 1;
|
||||
}
|
||||
if (mflag && chmod(*argv, mode) < 0) {
|
||||
weprintf("chmod %s:", *argv);
|
||||
|
Loading…
Reference in New Issue
Block a user