[PATCH] D52648: [Support] Listing a directory containing dangling symlinks is not an error.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 28 15:53:02 PDT 2018


Dor1s accepted this revision.
Dor1s added inline comments.


================
Comment at: include/llvm/Support/FileSystem.h:1263
+        if (status)
+          type = status->type();
+        // Otherwise broken symlink, and we'll continue.
----------------
sammccall wrote:
> Dor1s wrote:
> > Can this `status` be different from the value obtained on line 1259?
> Line 1259 gets the type (not status) from the directory listing, which will be `symlink_file` if the thing in the dir is a symlink.
> 
> The `stat()` is a resolving stat on the symlink (notice here type is `symlink_file` and `Follow` is true), so the new type is of the symlink *target*. This allows us to traverse into it if it's a directory.
Thanks for clarifying!


Repository:
  rL LLVM

https://reviews.llvm.org/D52648





More information about the llvm-commits mailing list