]> Sergey Matveev's repositories - nnn.git/commitdiff
Try to open file to see access errors on the status bar
authorlostd <lostd@2f30.org>
Wed, 22 Oct 2014 21:31:45 +0000 (00:31 +0300)
committerlostd <lostd@2f30.org>
Wed, 22 Oct 2014 21:31:45 +0000 (00:31 +0300)
noice.c

diff --git a/noice.c b/noice.c
index 1d0a0c96da9557d3b0956b51798b179c8d2254e4..c276db39d9bfa14688ba83e594edc3c70875355c 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -569,7 +569,7 @@ browse(const char *ipath, const char *ifilter)
        DIR *dirp;
        struct entry *dents;
        int i, n, cur;
-       int r, ret;
+       int r, ret, fd;
        char *path = xrealpath(ipath);
        char *filter = xstrdup(ifilter);
        regex_t filter_re;
@@ -683,6 +683,12 @@ nochange:
                        DPRINTF_S(name);
 
                        /* Get path info */
+                       fd = openat(dirfd(dirp), name, O_RDONLY | O_NONBLOCK);
+                       if (fd == -1) {
+                               printwarn();
+                               goto nochange;
+                       }
+                       close(fd);
                        r = fstatat(dirfd(dirp), name, &sb, 0);
                        if (r == -1) {
                                printwarn();