Files
llvm-mingw/patches/llvm-project/0019-libcxx-Explicitly-return-the-expected-error-code-in-.patch
T

40 lines
1.4 KiB
Diff

From 69856f3e59b210249020504329e016c691f138e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 18 Dec 2020 13:34:35 +0200
Subject: [PATCH 19/24] [libcxx] Explicitly return the expected error code in
create_directories if the parent isn't a directory
On windows, going ahead and actually trying to create the directory
doesn't return an error code that maps to
std::errc::not_a_directory in this case.
This fixes two cases of
TEST_CHECK(ErrorIs(ec, std::errc::not_a_directory))
in filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
for windows (in testcases added in 59c72a70121567f7aee347e96b4ac8f3cfe9f4b2).
Differential Revision: https://reviews.llvm.org/D97090
(cherry picked from commit c5e8f024dca9ddf6d14253fe2fcc5c4956de2d3c)
---
libcxx/src/filesystem/operations.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index a3b93b594a07..bfc6c44d4ce4 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -1022,7 +1022,8 @@ bool __create_directories(const path& p, error_code* ec) {
if (ec && *ec) {
return false;
}
- }
+ } else if (not is_directory(parent_st))
+ return err.report(errc::not_a_directory);
}
return __create_directory(p, ec);
}
--
2.25.1