diff options
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -634,9 +634,17 @@ int create_pull_request_dir(pull_request *pr, index_t *idx, const char *root) { } /* Is there no existing directory? */ - if (stat(pr_dir, &st) < 0) { - /* Create a directory with a name of the stringified ID. */ - mkdir(pr_dir, 0755); + switch (is_dir(pr_dir)) { + /* PR root exists, and is a directory. */ + case 1 : break; + /* PR root exists, but isn't a directory. */ + case 0 : + log(LOG_ERR, "PR root \"%s\" exists, but isn't a directory.", pr_dir); + free(pr_dir); + return -1; + break; + /* PR root doesn't exist. */ + default : mkdirp(pr_dir, 0755); break; } /* Did we fail to create the info file? */ |