noice.c | 10 +++++++++- diff --git a/noice.c b/noice.c index 90fc3bd168fe0ff9850ad9b2ba75d2d319d5b0d4..9a9fc6a4e477f5647f9fdeaf9a52faa0cfac3945 100644 --- a/noice.c +++ b/noice.c @@ -615,6 +615,10 @@ case SEL_BACK: /* 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 @@ DPRINTF_U(sb.st_mode); 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 @@ ipath = "/"; } /* Test initial path */ - if (!testopendir(ipath)) + if (testopendir(ipath) == 0) printerr(1, ipath); /* Set locale before curses setup */