Only process the ``PWD'' environmental var if built with "WANT_ENV_PWD"

defined.  Bash v2 sets PWD and it creates major problems for those of us
with /usr/src being a symlink.  See the lists for examples of the problems.
This commit is contained in:
David E. O'Brien 1998-10-18 00:51:46 +00:00
parent d58fb9293a
commit 9471b48afe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40500
2 changed files with 14 additions and 5 deletions

View file

@ -47,7 +47,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#endif
static const char rcsid[] =
"$Id: main.c,v 1.25 1998/07/26 17:06:05 imp Exp $";
"$Id: main.c,v 1.26 1998/09/09 14:58:30 kato Exp $";
#endif /* not lint */
/*-
@ -434,8 +434,12 @@ main(argc, argv)
{
Lst targs; /* target nodes to create -- passed to Make_Init */
Boolean outOfDate = TRUE; /* FALSE if all targets up to date */
struct stat sb, sa;
char *p, *p1, *path, *pathp, *pwd;
struct stat sa;
char *p, *p1, *path, *pathp;
#ifdef WANT_ENV_PWD
struct stat sb;
char *pwd;
#endif
char mdpath[MAXPATHLEN + 1];
char obpath[MAXPATHLEN + 1];
char cdpath[MAXPATHLEN + 1];
@ -470,11 +474,13 @@ main(argc, argv)
if (stat(curdir, &sa) == -1)
err(2, "%s", curdir);
#ifdef WANT_ENV_PWD
if ((pwd = getenv("PWD")) != NULL) {
if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino &&
sa.st_dev == sb.st_dev)
(void) strcpy(curdir, pwd);
}
#endif
#if defined(__i386__)
/*
@ -558,7 +564,9 @@ main(argc, argv)
objdir = curdir;
}
#ifdef WANT_ENV_PWD
setenv("PWD", objdir, 1);
#endif
create = Lst_Init(FALSE);
makefiles = Lst_Init(FALSE);

View file

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" $Id: make.1,v 1.11 1997/07/24 06:58:07 charnier Exp $
.\" $Id: make.1,v 1.12 1998/05/25 03:28:37 steve Exp $
.\"
.Dd March 19, 1994
.Dt MAKE 1
@ -428,7 +428,8 @@ entered into the environment for all programs which
.Nm make
executes.
.It Ev PWD
Alternate path to the current directory.
Alternate path to the current directory. Supported if built with WANT_ENV_PWD
defined.
.Nm make
normally sets
.Ql Va .CURDIR