diff options
author | kaleb <empty> | 1994-05-12 16:55:46 +0000 |
---|---|---|
committer | kaleb <empty> | 1994-05-12 16:55:46 +0000 |
commit | 2435d6bf2033db678669815f40b78dfed517be1d (patch) | |
tree | 1711826e621ffd87e44ef8e9845175a46c01cef0 | |
parent | 8cfc5c8bf3175ef6953850e656eb2eff1b74c47b (diff) |
xbug 6759, need to waitpid in system() emulation to avoid creating
defunct shell processes. Also remove $SHELL support to be generally
consistent with all other systems
-rw-r--r-- | xc/programs/twm/menus.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/xc/programs/twm/menus.c b/xc/programs/twm/menus.c index 958c21c5e..fb66f7c2b 100644 --- a/xc/programs/twm/menus.c +++ b/xc/programs/twm/menus.c @@ -53,7 +53,7 @@ in this Software without prior written authorization from the X Consortium. /*********************************************************************** * - * $XConsortium: menus.c,v 1.194 93/11/19 09:39:19 kaleb Exp $ + * $XConsortium: menus.c,v 1.195 94/04/17 20:38:17 kaleb Exp $ * * twm menu code * @@ -2402,26 +2402,18 @@ MenuRoot *root; */ #if defined(sun) && defined(SVR4) -static void System (s) +static int System (s) char *s; { - int pid; - char* shell; - char* shellname; - + int pid, status; if ((pid = fork ()) == 0) { (void) setpgrp(); - if ((shell = getenv ("SHELL")) != NULL) { - shellname = strrchr(shell, '/'); - if (shellname == NULL) - shellname = shell; - else - shellname++; - execl (shell, shellname, "-c", s, 0); - } execl ("/bin/sh", "sh", "-c", s, 0); - } + } else + waitpid (pid, &status, 0); + return status; } +#define system(s) System(s) #endif void @@ -2458,11 +2450,7 @@ Execute(s) restorevar = 1; } -#if defined(sun) && defined(SVR4) - System (s); -#else (void) system (s); -#endif if (restorevar) { /* why bother? */ (void) sprintf (buf, "DISPLAY=%s", oldDisplay); |