summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/util.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c
index 6002738..f2906b1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -561,14 +561,17 @@ int mkdir_p(const char *path, mode_t m) {
quit = 1;
}
- *e = 0;
- if (mkdir(tmp, m) < 0) {
- if (errno != EEXIST) {
- fprintf(stderr, "XX mkdir(\"%s\"): %s\n", tmp, strerror(errno));
- return -1;
+ if (e != b) {
+ *e = 0;
+
+ if (mkdir(tmp, m) < 0) {
+ if (errno != EEXIST) {
+ fprintf(stderr, "mkdir(\"%s\"): %s\n", tmp, strerror(errno));
+ return -1;
+ }
}
+ *e = '/';
}
- *e = '/';
b = e+1;
}