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:
Michael Forney 2016-12-14 19:40:04 -08:00 committed by Anselm R Garbe
parent 830ca05c25
commit e795946971

View File

@ -38,8 +38,7 @@ 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) {
} else if (mkdir(*argv, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
weprintf("mkdir %s:", *argv);
ret = 1;
}