sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit e795946971f08b80ce9518088e590afa64bf0179
parent 830ca05c25984586f3578f11a7a8038304d71719
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 14 Dec 2016 19:40:04 -0800

mkdir: Fail on EEXIST with no -p flag

mkdir without the -p flag should only exit success if it actually made
the directory.

Diffstat:
Mmkdir.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mkdir.c b/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);