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:
parent
9d276d04b3
commit
bceacccb7b
3
utils.c
3
utils.c
@ -267,7 +267,8 @@ make_dir(char * path, mode_t mode)
|
|||||||
if (mkdir(path, mode) < 0) {
|
if (mkdir(path, mode) < 0) {
|
||||||
/* If we failed for any other reason than the directory
|
/* If we failed for any other reason than the directory
|
||||||
* already exists, output a diagnostic and return -1.*/
|
* 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);
|
DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot create directory '%s'\n", path);
|
||||||
if (c)
|
if (c)
|
||||||
*s = c;
|
*s = c;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user