Fixes directory creation.

This commit is contained in:
Andrea Mazzoleni 2013-02-24 09:38:46 +01:00
parent d6c3b1b326
commit afd4120622

14
util.c
View file

@ -679,13 +679,13 @@ int mkancestor(const char* file)
} }
/* try creating it */ /* try creating it */
if (mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) { if (mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0) {
/* if it already exists, we are done */ /* just created */
if (errno == EEXIST) { return 0;
return 0; }
} if (errno == EEXIST) {
fprintf(stderr, "Error creating directory '%s'. %s.\n", dir, strerror(errno)); /* it already exists */
return -1; return 0;
} }
/* recursively create them all */ /* recursively create them all */