[libcxx-commits] [PATCH] D97090: [libcxx] Explicitly return the expected error code in create_directories if the parent isn't a directory
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 19 14:26:05 PST 2021
mstorsjo created this revision.
mstorsjo added reviewers: curdeius, ldionne, libc++.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
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 <https://reviews.llvm.org/rG59c72a70121567f7aee347e96b4ac8f3cfe9f4b2>).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97090
Files:
libcxx/src/filesystem/operations.cpp
Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -1023,7 +1023,8 @@
if (ec && *ec) {
return false;
}
- }
+ } else if (not is_directory(parent))
+ return err.report(errc::not_a_directory);
}
return __create_directory(p, ec);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97090.325089.patch
Type: text/x-patch
Size: 415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210219/d703117e/attachment.bin>
More information about the libcxx-commits
mailing list