summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authormycroft <mycroft@NetBSD.org>1993-07-29 22:09:42 +0000
committermycroft <mycroft@NetBSD.org>1993-07-29 22:09:42 +0000
commitbdbbba0b7389ea226365790dc4f807616f04d579 (patch)
treefdbef63fd38890eb5748f3ba8e00cbf82f06022c /lib/libc/stdlib
parent8846a747820432bc8fda58684e0e15e6d217970e (diff)
Use execve() rather than execl(). This is faster and doesn't use malloc()
(and thus avoids an annoying problem which only seems to manifest itself in KCL).
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/system.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
index f8c3a2352d8..c47e86743c3 100644
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -43,6 +43,8 @@ static char sccsid[] = "@(#)system.c 5.10 (Berkeley) 2/23/91";
#include <unistd.h>
#include <paths.h>
+extern char **environ;
+
system(command)
const char *command;
{
@@ -50,6 +52,7 @@ system(command)
pid_t pid;
int omask;
sig_t intsave, quitsave;
+ char **argp = {"sh", "-c", command, NULL};
if (!command) /* just checking... */
return(1);
@@ -63,7 +66,7 @@ system(command)
return(pstat.w_status);
case 0: /* child */
(void)sigsetmask(omask);
- execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
+ execve(_PATH_BSHELL, argp, environ);
_exit(127);
}
intsave = signal(SIGINT, SIG_IGN);