diff options
author | Martin Storsjö <martin@martin.st> | 2020-12-18 13:34:35 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-03-02 22:21:29 +0200 |
commit | c5e8f024dca9ddf6d14253fe2fcc5c4956de2d3c (patch) | |
tree | 2fac7529f7c0f9e02476e348a7e5b5c8733a4fd0 /libcxx/src/filesystem/operations.cpp | |
parent | 415c67ba4ce58b5ab29fa17f033b944e420e62bc (diff) | |
download | llvm-c5e8f024dca9ddf6d14253fe2fcc5c4956de2d3c.zip llvm-c5e8f024dca9ddf6d14253fe2fcc5c4956de2d3c.tar.gz llvm-c5e8f024dca9ddf6d14253fe2fcc5c4956de2d3c.tar.bz2 |
[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
Diffstat (limited to 'libcxx/src/filesystem/operations.cpp')
-rw-r--r-- | libcxx/src/filesystem/operations.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp index 06efb72..f112168 100644 --- a/libcxx/src/filesystem/operations.cpp +++ b/libcxx/src/filesystem/operations.cpp @@ -1023,7 +1023,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); } |