aboutsummaryrefslogtreecommitdiff
path: root/jim-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'jim-file.c')
-rw-r--r--jim-file.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/jim-file.c b/jim-file.c
index 725cc8a..053873c 100644
--- a/jim-file.c
+++ b/jim-file.c
@@ -430,14 +430,16 @@ static int mkdir_all(char *path)
while (ok--) {
/* Must have failed the first time, so recursively make the parent and try again */
- char *slash = strrchr(path, '/');
+ {
+ char *slash = strrchr(path, '/');
- if (slash && slash != path) {
- *slash = 0;
- if (mkdir_all(path) != 0) {
- return -1;
+ if (slash && slash != path) {
+ *slash = 0;
+ if (mkdir_all(path) != 0) {
+ return -1;
+ }
+ *slash = '/';
}
- *slash = '/';
}
first:
if (MKDIR_DEFAULT(path) == 0) {