Handle the cases of directory already create by another process

This commit is contained in:
Andrea Mazzoleni 2026-05-21 00:20:42 +02:00
parent 1aa808a106
commit 8749d0dfe3
2 changed files with 3 additions and 2 deletions

View file

@ -1209,7 +1209,8 @@ int mkancestor(const char* file)
}
/* create it */
if (mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
int ret = mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
if (ret != 0 && errno != EEXIST) {
/* LCOV_EXCL_START */
log_fatal(errno, "Error creating directory '%s'. %s.\n", dir, strerror(errno));
return -1;