]> Sergey Matveev's repositories - nnn.git/commitdiff
Show symlink even if target cannot be stat-ed
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 9 Dec 2019 16:50:46 +0000 (22:20 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 9 Dec 2019 16:50:46 +0000 (22:20 +0530)
src/dbg.h
src/nnn.c

index 7bd757a47a63d7910b4ee732223a64ed102dd68e..28f41181d66b5308824cc44bf97b661169232146 100644 (file)
--- a/src/dbg.h
+++ b/src/dbg.h
@@ -76,10 +76,10 @@ static void disabledbg(void)
        close(DEBUG_FD);
 }
 
-#define DPRINTF_D(x) xprintf(DEBUG_FD, #x "=%d\n", x)
-#define DPRINTF_U(x) xprintf(DEBUG_FD, #x "=%u\n", x)
-#define DPRINTF_S(x) xprintf(DEBUG_FD, #x "=%s\n", x)
-#define DPRINTF_P(x) xprintf(DEBUG_FD, #x "=%p\n", x)
+#define DPRINTF_D(x) xprintf(DEBUG_FD, #x "=%d [ln %d]\n", x, __LINE__)
+#define DPRINTF_U(x) xprintf(DEBUG_FD, #x "=%u [ln %d]\n", x, __LINE__)
+#define DPRINTF_S(x) xprintf(DEBUG_FD, #x "=%s [ln %d]\n", x, __LINE__)
+#define DPRINTF_P(x) xprintf(DEBUG_FD, #x "=%p [ln %d]\n", x, __LINE__)
 #else
 #define DPRINTF_D(x)
 #define DPRINTF_U(x)
index e7e3ecdc362791328887cb0dd76b57d2bb7be342..a1cc4449883956344fb5dd416b905f0c2c25d9bd 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3756,15 +3756,12 @@ static int dentfill(char *path, struct entry **dents)
 
                if (fstatat(fd, namep, &sb, flags) == -1) {
                        /* List a symlink with target missing */
-                       if (!flags && errno == ENOENT) {
-                               if (fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW) == -1) {
+                       if (flags || (!flags && fstatat(fd, namep, &sb, AT_SYMLINK_NOFOLLOW) == -1)) {
+                               DPRINTF_U(flags);
+                               if (!flags) {
                                        DPRINTF_S(namep);
                                        DPRINTF_S(strerror(errno));
-                                       continue;
                                }
-                       } else {
-                               DPRINTF_S(namep);
-                               DPRINTF_S(strerror(errno));
                                continue;
                        }
                }