aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-10-22 17:25:25 +0100
committersin <sin@2f30.org>2014-10-22 17:25:25 +0100
commit48f9c5a79df7431c60aee74ddea0d4a47384a373 (patch)
tree72a26c30c71e72d1cffe33f426a9f9218f8dc0d8 /noice.c
parentaedec0ddf3cfc31ba50e5a10f0f3655abcdb2438 (diff)
downloadnoice-48f9c5a79df7431c60aee74ddea0d4a47384a373.tar.gz
Test if we can back out/enter directories
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/noice.c b/noice.c
index 90fc3bd..9a9fc6a 100644
--- a/noice.c
+++ b/noice.c
@@ -615,6 +615,10 @@ nochange:
/* There is no going back */
if (strcmp(path, "/") == 0)
goto nochange;
+ if (testopendir(path) == 0) {
+ printwarn();
+ goto nochange;
+ }
dir = xdirname(path);
free(path);
path = dir;
@@ -642,6 +646,10 @@ nochange:
switch (sb.st_mode & S_IFMT) {
case S_IFDIR:
+ if (testopendir(path) == 0) {
+ printwarn();
+ goto nochange;
+ }
free(path);
path = xrealpath(name);
/* Reset filter */
@@ -745,7 +753,7 @@ main(int argc, char *argv[])
}
/* Test initial path */
- if (!testopendir(ipath))
+ if (testopendir(ipath) == 0)
printerr(1, ipath);
/* Set locale before curses setup */
Un proyecto texto-plano.xyz