aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-01-17 02:40:02 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-01-17 02:40:02 +0530
commit4f233c161ae205ae818801e6d86071933d4f5c4a (patch)
tree41b9a6a67648789b1bbcb36c8585738ae14e78e2 /src/nnn.c
parentfeec63ebb382b7e92dc6d4a2b767f89dc1ab4c7b (diff)
downloadnnn-4f233c161ae205ae818801e6d86071933d4f5c4a.tar.gz
Remove redundant check
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/nnn.c b/src/nnn.c
index cec4b7c..5dd47ce 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4515,6 +4515,15 @@ static bool browse(char *ipath, const char *session)
errexit();
begin:
+ /* Can fail when permissions change while browsing.
+ * It's assumed that path IS a directory when we are here.
+ */
+ if (access(path, R_OK) == -1) {
+ DPRINTF_S("directory inaccessible");
+ find_accessible_parent(path, newpath, lastname, &presel);
+ setdirwatch();
+ }
+
if (cfg.selmode && lastdir[0])
lastappendpos = selbufpos;
@@ -4538,12 +4547,6 @@ begin:
}
#endif
- /* Can fail when permissions change while browsing.
- * It's assumed that path IS a directory when we are here.
- */
- if (access(path, R_OK) == -1)
- printwarn(&presel);
-
populate(path, lastname);
if (g_states & STATE_INTERRUPTED) {
g_states &= ~STATE_INTERRUPTED;
@@ -4581,12 +4584,8 @@ nochange:
}
/* If CWD is deleted or moved or perms changed, find an accessible parent */
- if (access(path, F_OK)) {
- DPRINTF_S("directory inaccessible");
- find_accessible_parent(path, newpath, lastname, &presel);
- setdirwatch();
+ if (access(path, F_OK))
goto begin;
- }
/* If STDIN is no longer a tty (closed) we should exit */
if (!isatty(STDIN_FILENO) && !cfg.picker) {
@@ -6156,12 +6155,6 @@ int main(int argc, char *argv[])
}
signal(SIGQUIT, SIG_IGN);
- /* Test initial path */
- if (!xdiraccess(initpath)) {
- xerror();
- return _FAILURE;
- }
-
#ifndef NOLOCALE
/* Set locale */
setlocale(LC_ALL, "");