mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Handle the cases of directory already create by another process
This commit is contained in:
parent
1aa808a106
commit
8749d0dfe3
2 changed files with 3 additions and 2 deletions
|
|
@ -1880,7 +1880,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
|
||||
/* create it */
|
||||
ret = mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
if (ret != 0) {
|
||||
if (ret != 0 && errno != EEXIST) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal(errno, "Error creating directory '%s%s'. %s.\n", disk->dir, dir->sub, strerror(errno));
|
||||
log_tag("dir_%s:%u:%s:%s: Create directory error. %s.\n", es(errno), i, disk->name, esc_tag(dir->sub, esc_buffer), strerror(errno));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue