summaryrefslogtreecommitdiffstats
path: root/bin/sh/main.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-04-17 14:35:46 +0000
committerjilles <jilles@FreeBSD.org>2010-04-17 14:35:46 +0000
commit286029c47836178eb034bb3cff6b884f0a4ed74d (patch)
treebb356bbe40acadf8907130038ede6c0a505c1777 /bin/sh/main.c
parent66c04c10a0daa86550d2714dec2c47bd88f184b3 (diff)
downloadFreeBSD-src-286029c47836178eb034bb3cff6b884f0a4ed74d.zip
FreeBSD-src-286029c47836178eb034bb3cff6b884f0a4ed74d.tar.gz
sh: On startup of the shell, use PWD from the environment if it is valid.
Unset PWD if it is incorrect and no value for it can be determined. This preserves the logical current directory across shell invocations. Example (assuming /home is a symlink): $ cd $ pwd /home/foo $ sh $ pwd /home/foo Formerly the second pwd would show the physical path (symlinks resolved).
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r--bin/sh/main.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index 50a8813..ecbb12d 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -153,10 +153,7 @@ main(int argc, char *argv[])
init();
setstackmark(&smark);
procargs(argc, argv);
- if (getpwd() == NULL && iflag)
- out2fmt_flush("sh: cannot determine working directory\n");
- if (getpwd() != NULL)
- setvar ("PWD", getpwd(), VEXPORT);
+ pwd_init(iflag);
if (iflag)
chkmail(1);
if (argv[0] && argv[0][0] == '-') {
OpenPOWER on IntegriCloud