[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
Sat Feb 20 05:51:19 PST 2021


mstorsjo updated this revision to Diff 325194.
mstorsjo added a comment.

Check the existing `parent_st` instead of re-stat'ing the directory.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97090/new/

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_st))
+      return err.report(errc::not_a_directory);
   }
   return __create_directory(p, ec);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97090.325194.patch
Type: text/x-patch
Size: 418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210220/9c211c14/attachment.bin>


More information about the libcxx-commits mailing list