mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 09:08:49 -05:00
curl: fix time-of-check, time-of-use race in dir creation
Patch-by: Jay Satiro Detected by Coverity Fixes #2739 Closes #2912
This commit is contained in:
parent
2345388728
commit
f16bed0c45
@ -139,14 +139,12 @@ CURLcode create_dir_hierarchy(const char *outfile, FILE *errors)
|
||||
else
|
||||
snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir);
|
||||
}
|
||||
if(access(dirbuildup, F_OK) == -1) {
|
||||
if(-1 == mkdir(dirbuildup, (mode_t)0000750)) {
|
||||
if((-1 == mkdir(dirbuildup, (mode_t)0000750)) && (errno != EEXIST)) {
|
||||
show_dir_errno(errors, dirbuildup);
|
||||
result = CURLE_WRITE_ERROR;
|
||||
break; /* get out of loop */
|
||||
}
|
||||
}
|
||||
}
|
||||
tempdir = tempdir2;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user