[llvm] [Support] Report EISDIR when opening a directory (PR #79880)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 10:31:48 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff d5e8a273fddcf4abbfc59d16f08e735f7cefff93 97cebcb4bca02346f1c0321358fe7797111baacb -- llvm/lib/Support/Unix/Path.inc llvm/unittests/Support/CommandLineTest.cpp llvm/unittests/Support/Path.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index fe8af76bd4..4996d98e57 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -1025,12 +1025,12 @@ std::error_code openFile(const Twine &Name, int &ResultFD,
   if ((ResultFD = sys::RetryAfterSignal(-1, Open)) < 0)
     return std::error_code(errno, std::generic_category());
   if (Access == FA_Read) {
-    struct stat Status;    
+    struct stat Status;
     if (fstat(ResultFD, &Status) == -1)
       return std::error_code(errno, std::generic_category());
     if (S_ISDIR(Status.st_mode))
       return make_error_code(errc::is_a_directory);
-  } 
+  }
 #ifndef O_CLOEXEC
   if (!(Flags & OF_ChildInherit)) {
     int r = fcntl(ResultFD, F_SETFD, FD_CLOEXEC);

``````````

</details>


https://github.com/llvm/llvm-project/pull/79880


More information about the llvm-commits mailing list