Do not let make_dir fail on EISDIR

Some systems set errno to EISDIR when a directory exists already,
instead of EEXIST.
This commit is contained in:
Benoît Knecht 2011-07-21 15:17:24 +02:00
parent 9d276d04b3
commit bceacccb7b

View File

@ -267,7 +267,8 @@ make_dir(char * path, mode_t mode)
if (mkdir(path, mode) < 0) {
/* If we failed for any other reason than the directory
* already exists, output a diagnostic and return -1.*/
if (errno != EEXIST || (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
if ((errno != EEXIST && errno != EISDIR)
|| (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot create directory '%s'\n", path);
if (c)
*s = c;