summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorschweikh <schweikh@FreeBSD.org>2006-02-04 14:47:19 +0000
committerschweikh <schweikh@FreeBSD.org>2006-02-04 14:47:19 +0000
commitf4138ecb02ca21b2144f23b6d1cff59f53e2b43e (patch)
tree99b17c6cc7a395990d5d7d78c8f2700e7f508e91 /bin
parenta1b48439af3126d47f493f7ecdf3afc239ad4524 (diff)
downloadFreeBSD-src-f4138ecb02ca21b2144f23b6d1cff59f53e2b43e.zip
FreeBSD-src-f4138ecb02ca21b2144f23b6d1cff59f53e2b43e.tar.gz
Initialize PWD early on (don't expect it to be inherited from the
environment or set it only when changing directories with cd). PR: standards/92640
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index cfdfe9d..5ad69f2 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -155,6 +155,8 @@ main(int argc, char *argv[])
procargs(argc, argv);
if (getpwd() == NULL && iflag)
out2str("sh: cannot determine working directory\n");
+ if (getpwd() != NULL)
+ setvar ("PWD", getpwd(), VEXPORT);
if (argv[0] && argv[0][0] == '-') {
state = 1;
read_profile("/etc/profile");
OpenPOWER on IntegriCloud