Module Name: src
Committed By: sjg
Date: Tue Jul 3 21:03:41 UTC 2012
Modified Files:
src/usr.bin/make: job.c
Log Message:
An X!= command, can cause Shell_Init() to be called before Job_ParseShell().
Job_ParseShell() should call Shell_Init() again if needed
to ensure shellPath is correct.
To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/usr.bin/make/job.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.162 src/usr.bin/make/job.c:1.163
--- src/usr.bin/make/job.c:1.162 Tue Jun 12 19:21:50 2012
+++ src/usr.bin/make/job.c Tue Jul 3 21:03:40 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.162 2012/06/12 19:21:50 joerg Exp $ */
+/* $NetBSD: job.c,v 1.163 2012/07/03 21:03:40 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.162 2012/06/12 19:21:50 joerg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.163 2012/07/03 21:03:40 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: job.c,v 1.162 2012/06/12 19:21:50 joerg Exp $");
+__RCSID("$NetBSD: job.c,v 1.163 2012/07/03 21:03:40 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -2423,7 +2423,7 @@ Job_ParseShell(char *line)
* If no path was given, the user wants one of the pre-defined shells,
* yes? So we find the one s/he wants with the help of JobMatchShell
* and set things up the right way. shellPath will be set up by
- * Job_Init.
+ * Shell_Init.
*/
if (newShell.name == NULL) {
Parse_Error(PARSE_FATAL, "Neither path nor name specified");
@@ -2438,6 +2438,12 @@ Job_ParseShell(char *line)
}
commandShell = sh;
shellName = newShell.name;
+ if (shellPath) {
+ /* Shell_Init has already been called! Do it again. */
+ free(UNCONST(shellPath));
+ shellPath = NULL;
+ Shell_Init();
+ }
}
} else {
/*