diff options
author | Christopher Faylor <me@cgf.cx> | 2003-09-20 00:31:13 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-09-20 00:31:13 +0000 |
commit | d1fb625d2bbe16aeb77d403d62742b0240ca7024 (patch) | |
tree | 282edbea12074ba940905d8930168a69d63c3601 /winsup/cygwin/syscalls.cc | |
parent | 41946df6111b6daf93518b22ca49c54544c77599 (diff) | |
download | newlib-d1fb625d2bbe16aeb77d403d62742b0240ca7024.zip newlib-d1fb625d2bbe16aeb77d403d62742b0240ca7024.tar.gz newlib-d1fb625d2bbe16aeb77d403d62742b0240ca7024.tar.bz2 |
* syscalls.cc (system): Strip signal considerations from here so that they are
not inherited by a child process.
* spawn.cc (spawn_guts): Handle system() signal stuff here.
* winsup.h (_P_SYSTEM): Define.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 11cacd5..9af0434 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1450,21 +1450,6 @@ done: return res; } -struct system_cleanup_args -{ - _sig_func_ptr oldint, oldquit; - sigset_t old_mask; -}; - -static void system_cleanup (void *args) -{ - struct system_cleanup_args *cleanup_args = (struct system_cleanup_args *) args; - - signal (SIGINT, cleanup_args->oldint); - signal (SIGQUIT, cleanup_args->oldquit); - (void) sigprocmask (SIG_SETMASK, &cleanup_args->old_mask, 0); -} - extern "C" int system (const char *cmdstring) { @@ -1476,34 +1461,22 @@ system (const char *cmdstring) sigframe thisframe (mainthread); int res; const char* command[4]; - struct system_cleanup_args cleanup_args; - sigset_t child_block; if (cmdstring == (const char *) NULL) - return 1; - - cleanup_args.oldint = signal (SIGINT, SIG_IGN); - cleanup_args.oldquit = signal (SIGQUIT, SIG_IGN); - sigemptyset (&child_block); - sigaddset (&child_block, SIGCHLD); - (void) sigprocmask (SIG_BLOCK, &child_block, &cleanup_args.old_mask); + return 1; command[0] = "sh"; command[1] = "-c"; command[2] = cmdstring; command[3] = (const char *) NULL; - pthread_cleanup_push (system_cleanup, (void *) &cleanup_args); - - if ((res = spawnvp (_P_WAIT, "sh", command)) == -1) + if ((res = spawnvp (_P_SYSTEM, "sh", command)) == -1) { // when exec fails, return value should be as if shell // executed exit (127) res = 127; } - pthread_cleanup_pop (1); - return res; } |