Merge pull request #34 from jeanguyomarch/toctou-race

fix: TOCTOU race when creating directories
This commit is contained in:
gulrak 2019-11-06 19:54:09 +01:00 committed by GitHub
commit 741eaca3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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