mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -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
|
else
|
||||||
snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir);
|
snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir);
|
||||||
}
|
}
|
||||||
if(access(dirbuildup, F_OK) == -1) {
|
if((-1 == mkdir(dirbuildup, (mode_t)0000750)) && (errno != EEXIST)) {
|
||||||
if(-1 == mkdir(dirbuildup, (mode_t)0000750)) {
|
|
||||||
show_dir_errno(errors, dirbuildup);
|
show_dir_errno(errors, dirbuildup);
|
||||||
result = CURLE_WRITE_ERROR;
|
result = CURLE_WRITE_ERROR;
|
||||||
break; /* get out of loop */
|
break; /* get out of loop */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
tempdir = tempdir2;
|
tempdir = tempdir2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user