1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

[PathV2]: Fix bug in create_directories which caused infinite recursion on

som inputs.

Bug found and fix proposed by Kal Conley!

llvm-svn: 153225
This commit is contained in:
Michael J. Spencer 2012-03-21 23:09:14 +00:00
parent 3040cab7d6
commit eeeb93f428

View File

@ -654,12 +654,13 @@ error_code create_directories(const Twine &path, bool &existed) {
StringRef p = path.toStringRef(path_storage);
StringRef parent = path::parent_path(p);
bool parent_exists;
if (!parent.empty()) {
bool parent_exists;
if (error_code ec = fs::exists(parent, parent_exists)) return ec;
if (error_code ec = fs::exists(parent, parent_exists)) return ec;
if (!parent_exists)
if (error_code ec = create_directories(parent, existed)) return ec;
if (!parent_exists)
if (error_code ec = create_directories(parent, existed)) return ec;
}
return create_directory(p, existed);
}