aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librc/librc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 53625759..9d9e7461 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -133,15 +133,13 @@ recursive_mkdir(const char *pathname, int mode)
return 0;
}
- for (p = dir + 1; p; p++) {
- if (*p == '/') {
- *p = '\0';
- if (mkdir(dir, mode) != 0 && errno != EEXIST) {
- free(dir);
- return -1;
- }
- *p = '/';
+ for (p = strchr(dir + 1, '/'); p; p = strchr(p + 1, '/')) {
+ *p = '\0';
+ if (mkdir(dir, mode) != 0 && errno != EEXIST) {
+ free(dir);
+ return -1;
}
+ *p = '/';
}
if (stat(dir, &sb) != 0) {