From 86c3f75512851abc37d84a5b3db603bff1db92cb Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 31 Mar 2017 01:34:41 +0530 Subject: [PATCH] Fix: can't go to parent if only dir name specified Invoking nnn with: nnn dir nnn ./dir nnn dir wouldn't allow user to navigate to parent directory. --- nnn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nnn.c b/nnn.c index dc19656b..57ed6e67 100644 --- a/nnn.c +++ b/nnn.c @@ -952,7 +952,11 @@ main(int argc, char *argv[]) printptr = &printent; if (argv[1] != NULL) { - ipath = argv[1]; + ipath = realpath(argv[1], cwd); + if (!ipath) { + fprintf(stderr, "%s: no such dir\n", argv[1]); + exit(1); + } } else { ipath = getcwd(cwd, sizeof(cwd)); if (ipath == NULL)