]> Sergey Matveev's repositories - nnn.git/commitdiff
List symlink with target missing
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 12 Aug 2019 22:52:34 +0000 (04:22 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 12 Aug 2019 22:52:34 +0000 (04:22 +0530)
src/nnn.c

index f0623f322f5deef074430616d97768a52a34f751..017ebe3eb437713637af83d04de064984b1e16ab 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3004,8 +3004,18 @@ static int dentfill(char *path, struct entry **dents)
                }
 
                if (fstatat(fd, namep, &sb, flags) == -1) {
-                       DPRINTF_S(namep);
-                       continue;
+                       /* List a symlink with target missing */
+                       if (!flags && errno == ENOENT) {
+                               if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
+                                       DPRINTF_S(namep);
+                                       DPRINTF_S(strerror(errno));
+                                       continue;
+                               }
+                       } else {
+                               DPRINTF_S(namep);
+                               DPRINTF_S(strerror(errno));
+                               continue;
+                       }
                }
 
                if (n == total_dents) {