From fc00faf7d0f4cd0b4637e719af52100861e8c17a Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 12 Aug 2021 10:46:12 +0530 Subject: [PATCH] Do not modify $PWD --- src/nnn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index b7654280..55557d6f 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -8315,8 +8315,9 @@ int main(int argc, char *argv[]) session = NULL; } else if (argc == optind) { /* Start in the current directory */ - initpath = getenv("PWD"); - initpath = initpath ? xstrdup(initpath) : getcwd(NULL, 0); + char *startpath = getenv("PWD"); + + initpath = startpath ? xstrdup(startpath) : getcwd(NULL, 0); if (!initpath) initpath = "/"; } else {