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
3
mkdir.c
3
mkdir.c
|
@ -38,8 +38,7 @@ main(int argc, char *argv[])
|
||||||
if (pflag) {
|
if (pflag) {
|
||||||
if (mkdirp(*argv) < 0)
|
if (mkdirp(*argv) < 0)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else if (mkdir(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0 &&
|
} else if (mkdir(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
|
||||||
errno != EEXIST) {
|
|
||||||
weprintf("mkdir %s:", *argv);
|
weprintf("mkdir %s:", *argv);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user