mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
Merge pull request #34 from jeanguyomarch/toctou-race
fix: TOCTOU race when creating directories
This commit is contained in:
commit
741eaca3fd
@ -3391,7 +3391,12 @@ GHC_INLINE bool create_directories(const path& p, std::error_code& ec) noexcept
|
||||
if (!exists(fs)) {
|
||||
create_directory(current, ec);
|
||||
if (ec) {
|
||||
return false;
|
||||
std::error_code tmp_ec;
|
||||
if (is_directory(current, tmp_ec)) {
|
||||
ec.clear();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef LWG_2935_BEHAVIOUR
|
||||
|
Loading…
x
Reference in New Issue
Block a user