diff options
| author | mycroft <mycroft@NetBSD.org> | 1993-07-29 22:09:42 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1993-07-29 22:09:42 +0000 |
| commit | bdbbba0b7389ea226365790dc4f807616f04d579 (patch) | |
| tree | fdbef63fd38890eb5748f3ba8e00cbf82f06022c /lib/libc/stdlib | |
| parent | 8846a747820432bc8fda58684e0e15e6d217970e (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.c | 5 |
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); |
