Diff between aa361e22164aeb8a161a75e7704ea265eeae7472 and 1f380468ce06e22ea66e12f5d681f7e21044b12f

Changed Files

File Additions Deletions Status
mesh/keyring.c +1 -1 modified
mesh/rpl.c +2 -2 modified
mesh/util.c +2 -2 modified

Full Patch

diff --git a/mesh/keyring.c b/mesh/keyring.c
index 5162177..b440911 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -50,7 +50,7 @@ static int open_key_file(struct mesh_node *node, const char *key_dir,
 
 	if (flags & O_CREAT) {
 		snprintf(fname, PATH_MAX, "%s%s", node_path, key_dir);
-		if (mkdir(fname, 0755) != 0)
+		if (mkdir(fname, 0755) != 0 && errno != EEXIST)
 			l_error("Failed to create dir(%d): %s", errno, fname);
 	}
 
diff --git a/mesh/rpl.c b/mesh/rpl.c
index 9a99afe..6bb3532 100644
--- a/mesh/rpl.c
+++ b/mesh/rpl.c
@@ -255,7 +255,7 @@ void rpl_update(struct mesh_node *node, uint32_t cur)
 
 	/* Make sure path exists */
 	snprintf(path, PATH_MAX, "%s%s", node_path, rpl_dir);
-	if (mkdir(path, 0755) != 0)
+	if (mkdir(path, 0755) != 0 && errno != EEXIST)
 		l_error("Failed to create dir(%d): %s", errno, path);
 
 	dir = opendir(path);
@@ -293,7 +293,7 @@ bool rpl_init(const char *node_path)
 		return false;
 
 	snprintf(path, PATH_MAX, "%s%s", node_path, rpl_dir);
-	if (mkdir(path, 0755) != 0)
+	if (mkdir(path, 0755) != 0 && errno != EEXIST)
 		l_error("Failed to create dir(%d): %s", errno, path);
 	return true;
 }
diff --git a/mesh/util.c b/mesh/util.c
index d505e7a..82b57f6 100644
--- a/mesh/util.c
+++ b/mesh/util.c
@@ -118,13 +118,13 @@ int create_dir(const char *dir_name)
 		}
 
 		strncat(dir, prev + 1, next - prev);
-		if (mkdir(dir, 0755) != 0)
+		if (mkdir(dir, 0755) != 0 && errno != EEXIST)
 			l_error("Failed to create dir(%d): %s", errno, dir);
 
 		prev = next;
 	}
 
-	if (mkdir(dir_name, 0755) != 0)
+	if (mkdir(dir_name, 0755) != 0 && errno != EEXIST)
 		l_error("Failed to create dir(%d): %s", errno, dir_name);
 
 	return 0;