Do not modify $PWD

This commit is contained in:
Arun Prakash Jana 2021-08-12 10:46:12 +05:30
parent 42061b0399
commit fc00faf7d0
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -8315,8 +8315,9 @@ int main(int argc, char *argv[])
session = NULL; session = NULL;
} else if (argc == optind) { } else if (argc == optind) {
/* Start in the current directory */ /* Start in the current directory */
initpath = getenv("PWD"); char *startpath = getenv("PWD");
initpath = initpath ? xstrdup(initpath) : getcwd(NULL, 0);
initpath = startpath ? xstrdup(startpath) : getcwd(NULL, 0);
if (!initpath) if (!initpath)
initpath = "/"; initpath = "/";
} else { } else {