aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/filesystem/operations.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-02-27 19:12:25 +0200
committerMartin Storsjö <martin@martin.st>2021-03-05 10:49:01 +0200
commit99c7b532946508efcf6cd978d86ee24b2a66d096 (patch)
treedcff67f5ba14babaa8289f08ac48ff98041159c9 /libcxx/src/filesystem/operations.cpp
parent1773eec6928f4e37b377e23b84d7a2a07d0d1d0d (diff)
downloadllvm-99c7b532946508efcf6cd978d86ee24b2a66d096.zip
llvm-99c7b532946508efcf6cd978d86ee24b2a66d096.tar.gz
llvm-99c7b532946508efcf6cd978d86ee24b2a66d096.tar.bz2
[libcxx] Avoid infinite recursion in create_directories, if the root directory doesn't exist
Differential Revision: https://reviews.llvm.org/D97618
Diffstat (limited to 'libcxx/src/filesystem/operations.cpp')
-rw-r--r--libcxx/src/filesystem/operations.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index f112168..35f6937 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -1019,6 +1019,8 @@ bool __create_directories(const path& p, error_code* ec) {
if (not status_known(parent_st))
return err.report(m_ec);
if (not exists(parent_st)) {
+ if (parent == p)
+ return err.report(errc::invalid_argument);
__create_directories(parent, ec);
if (ec && *ec) {
return false;