summaryrefslogtreecommitdiffstats
path: root/usr.bin/make
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-05-22 14:53:18 +0000
committerru <ru@FreeBSD.org>2002-05-22 14:53:18 +0000
commit7d529109a8eef4f08e3bc6a3f4776582eab7765f (patch)
tree1245223cf02990c1b868cae1cdcab7979f1d4f86 /usr.bin/make
parent367d0965de6fb8535844d5baf237d0b7f8200647 (diff)
downloadFreeBSD-src-7d529109a8eef4f08e3bc6a3f4776582eab7765f.zip
FreeBSD-src-7d529109a8eef4f08e3bc6a3f4776582eab7765f.tar.gz
Do not run shell from /bin, run it from $PATH.
Bump MAKE_VERSION to 5200205221.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/Makefile2
-rw-r--r--usr.bin/make/compat.c14
-rw-r--r--usr.bin/make/job.c6
-rw-r--r--usr.bin/make/main.c12
-rw-r--r--usr.bin/make/pathnames.h2
5 files changed, 29 insertions, 7 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index b400d3c..448940b 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -15,7 +15,7 @@ SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
NOSHARED?= YES
-CFLAGS+=-DMAKE_VERSION=\"5200205220\"
+CFLAGS+=-DMAKE_VERSION=\"5200205221\"
main.o: ${MAKEFILE}
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index f0d08aa..d50068b 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -281,7 +281,11 @@ CompatRunCommand (cmdp, gnp)
* -e flag as well as -c if it's supposed to exit when it hits an
* error.
*/
- static char *shargv[4] = { "/bin/sh" };
+#ifndef _PATH_DEFSHELLDIR
+ static char *shargv[4] = { "sh" };
+#else /* _PATH_DEFSHELLDIR */
+ static char *shargv[4] = { _PATH_DEFSHELLDIR"/sh" };
+#endif /* _PATH_DEFSHELLDIR */
shargv[1] = (errCheck ? "-ec" : "-c");
shargv[2] = cmd;
@@ -293,7 +297,11 @@ CompatRunCommand (cmdp, gnp)
* This command must be passed by the shell for other reasons..
* or.. possibly not at all.
*/
- static char *shargv[4] = { "/bin/sh" };
+#ifndef _PATH_DEFSHELLDIR
+ static char *shargv[4] = { "sh" };
+#else /* _PATH_DEFSHELLDIR */
+ static char *shargv[4] = { _PATH_DEFSHELLDIR"/sh" };
+#endif /* _PATH_DEFSHELLDIR */
if (internal == -1) {
/* Command does not need to be executed */
@@ -333,7 +341,7 @@ CompatRunCommand (cmdp, gnp)
(void) write (STDERR_FILENO, strerror(errno), strlen(strerror(errno)));
(void) write (STDERR_FILENO, "\n", 1);
} else {
- (void)execv(av[0], av);
+ (void)execvp(av[0], av);
}
exit(1);
}
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index bf98c91..58ba738 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1283,7 +1283,7 @@ JobExec(job, argv)
Rmt_Exec(shellPath, argv, FALSE);
} else
#endif /* REMOTE */
- (void) execv(shellPath, argv);
+ (void) execvp(shellPath, argv);
(void) write(STDERR_FILENO, "Could not execute shell\n",
sizeof("Could not execute shell"));
@@ -2449,7 +2449,11 @@ Job_Init(maxproc, maxlocal)
* All default shells are located in _PATH_DEFSHELLDIR.
*/
shellName = commandShell->name;
+#ifndef _PATH_DEFSHELLDIR
+ shellPath = shellName;
+#else /* _PATH_DEFSHELLDIR */
shellPath = str_concat(_PATH_DEFSHELLDIR, shellName, STR_ADDSLASH);
+#endif /* _PATH_DEFSHELLDIR */
}
if (commandShell->exit == NULL) {
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index f517263..fca2a6b 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1018,9 +1018,17 @@ Cmd_Exec(cmd, err)
(void) close(fds[1]);
#if DEFSHELL == 1
- (void) execv("/bin/sh", args);
+#ifndef _PATH_DEFSHELLDIR
+ (void) execvp("sh", args);
+#else /* _PATH_DEFSHELLDIR */
+ (void) execv(_PATH_DEFSHELLDIR"/sh", args);
+#endif /* _PATH_DEFSHELLDIR */
#elif DEFSHELL == 2
- (void) execv("/bin/ksh", args);
+#ifndef _PATH_DEFSHELLDIR
+ (void) execvp("ksh", args);
+#else /* _PATH_DEFSHELLDIR */
+ (void) execv(_PATH_DEFSHELLDIR"/ksh", args);
+#endif /* _PATH_DEFSHELLDIR */
#else
#error "DEFSHELL must be 1 or 2."
#endif
diff --git a/usr.bin/make/pathnames.h b/usr.bin/make/pathnames.h
index d16167c..033901a 100644
--- a/usr.bin/make/pathnames.h
+++ b/usr.bin/make/pathnames.h
@@ -40,9 +40,11 @@
#ifndef _PATH_OBJDIRPREFIX
#define _PATH_OBJDIRPREFIX "/usr/obj"
#endif /* ! _PATH_OBJDIRPREFIX */
+#ifndef __FreeBSD__
#ifndef _PATH_DEFSHELLDIR
#define _PATH_DEFSHELLDIR "/bin"
#endif /* ! _PATH_DEFSHELLDIR */
+#endif /* not __FreeBSD__ */
#ifndef _PATH_DEFSYSMK
#define _PATH_DEFSYSMK "sys.mk"
#endif /* ! _PATH_DEFSYSMK */
OpenPOWER on IntegriCloud