diff --git a/dir.c b/dir.c index 26ac80f2..d143a3dc 100644 --- a/dir.c +++ b/dir.c @@ -38,21 +38,17 @@ int dir_create_dir(const char *dir, mode_t mode) { char copy[MAXPGPATH]; - char *parent; + char parent[MAXPGPATH]; strncpy(copy, dir, MAXPGPATH); - parent = dirname(copy); + strncpy(parent, dirname(copy), MAXPGPATH); /* Create parent first */ if (access(parent, F_OK) == -1) dir_create_dir(parent, mode); /* Create directory */ -#ifdef __darwin__ - if (mkdir(copy, mode) == -1) -#else if (mkdir(dir, mode) == -1) -#endif { if (errno == EEXIST) /* already exist */ return 0;