From bceacccb7b099413c2862550e910c270c25b21a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Thu, 21 Jul 2011 15:17:24 +0200 Subject: [PATCH] Do not let make_dir fail on EISDIR Some systems set errno to EISDIR when a directory exists already, instead of EEXIST. --- utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 57ae5a4..5382d53 100644 --- a/utils.c +++ b/utils.c @@ -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;