aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-05-07 12:39:56 +0100
committerRon Yorston <rmy@pobox.com>2022-05-07 12:39:56 +0100
commitc5c95b22834809a5ad2fef6ec86c9f6900cc2714 (patch)
tree014360eb32b6be36218ef2c53326ec89ddec02a5
parentecdc5b3ffabb58e3a9fc3a55a2a44323644995fc (diff)
downloadbusybox-w32-c5c95b22834809a5ad2fef6ec86c9f6900cc2714.tar.gz
busybox-w32-c5c95b22834809a5ad2fef6ec86c9f6900cc2714.tar.bz2
busybox-w32-c5c95b22834809a5ad2fef6ec86c9f6900cc2714.zip
ash: don't set OLDPWD on startup
Commit f9b753e70 (ash: set current working directory on startup) set the current working directory of an interactive, non-login shell during startup to ensure drives mapped to a network share and symlinks were reported correctly. It had the side effect of setting OLDPWD. This is unnecessary because the current working directory won't have changed. (GitHub issue #253)
-rw-r--r--shell/ash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index f42dc49c3..c2c1f2098 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -15774,7 +15774,8 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
15774 else if (!login_sh && iflag) { 15774 else if (!login_sh && iflag) {
15775 char *cwd = getcwd(NULL, 0); 15775 char *cwd = getcwd(NULL, 0);
15776 if (cwd) { 15776 if (cwd) {
15777 docd(cwd, 0); 15777 chdir(cwd);
15778 setpwd(NULL, 0);
15778 free(cwd); 15779 free(cwd);
15779 } 15780 }
15780 } 15781 }