summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/userpref.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/common/userpref.c b/common/userpref.c
index 231d456..ec1b182 100644
--- a/common/userpref.c
+++ b/common/userpref.c
@@ -250,16 +250,13 @@ static int mkdir_with_parents(const char *dir, int mode)
250 } 250 }
251 int res; 251 int res;
252 char *parent = strdup(dir); 252 char *parent = strdup(dir);
253 parent = dirname(parent); 253 char* parentdir = dirname(parent);
254 if (parent) { 254 if (parentdir) {
255 res = mkdir_with_parents(parent, mode); 255 res = mkdir_with_parents(parentdir, mode);
256 } else { 256 } else {
257 res = -1; 257 res = -1;
258 } 258 }
259 free(parent); 259 free(parent);
260 if (res == 0) {
261 mkdir_with_parents(dir, mode);
262 }
263 return res; 260 return res;
264} 261}
265 262