]> Sergey Matveev's repositories - nnn.git/commitdiff
Escape unreadable dirs we are already into
authorlostd <lostd@2f30.org>
Thu, 2 Jul 2015 00:07:09 +0000 (01:07 +0100)
committerlostd <lostd@2f30.org>
Thu, 2 Jul 2015 00:07:09 +0000 (01:07 +0100)
We care about the directory we are going to, so there is no reason
to get locked inside there if the parent is readable.

noice.c

diff --git a/noice.c b/noice.c
index ac965bd4cb2503942050facacfa48e1103b173a0..8fe094364523267e29b8c6e531b5761cbedfaa65 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -689,11 +689,12 @@ nochange:
                            strcmp(path, ".") == 0 ||
                            strchr(path, '/') == NULL)
                                goto nochange;
-                       if (canopendir(path) == 0) {
+                       dir = xdirname(path);
+                       if (canopendir(dir) == 0) {
+                               free(dir);
                                printwarn();
                                goto nochange;
                        }
-                       dir = xdirname(path);
                        /* Save history */
                        oldpath = path;
                        path = dir;