mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 18:03:54 +00:00
Made gitfo_mkdir_recurs() gracefully recover when a given directory already exists.
This commit is contained in:
parent
40c44d2fb6
commit
412de9a637
@ -323,10 +323,15 @@ int gitfo_mkdir_recurs(const char *path, int mode)
|
|||||||
error = GIT_SUCCESS;
|
error = GIT_SUCCESS;
|
||||||
pp = path_copy;
|
pp = path_copy;
|
||||||
|
|
||||||
while (error == 0 && (sp = strchr(pp, '/')) != 0) {
|
while (error == GIT_SUCCESS && (sp = strchr(pp, '/')) != 0) {
|
||||||
if (sp != pp && gitfo_isdir(path_copy) < GIT_SUCCESS) {
|
if (sp != pp && gitfo_isdir(path_copy) < GIT_SUCCESS) {
|
||||||
*sp = 0;
|
*sp = 0;
|
||||||
error = gitfo_mkdir(path_copy, mode);
|
error = gitfo_mkdir(path_copy, mode);
|
||||||
|
|
||||||
|
/* Do not choke while trying to recreate an existing directory */
|
||||||
|
if (errno == EEXIST)
|
||||||
|
error = GIT_SUCCESS;
|
||||||
|
|
||||||
*sp = '/';
|
*sp = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user