* spawn.cc (do_cleanup): Properly restore SIGINT/SIGQUIT even if they had

previously been SIG_DFL.
This commit is contained in:
Christopher Faylor 2005-03-02 15:32:34 +00:00
parent e04c777cc6
commit d83eb0c7d0
2 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2005-03-02 Christopher Faylor <cgf@timesys.com>
* spawn.cc (do_cleanup): Properly restore SIGINT/SIGQUIT even if they
had previously been SIG_DFL.
2005-03-01 Corinna Vinschen <corinna@vinschen.de> 2005-03-01 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Replace * fhandler_disk_file.cc (fhandler_disk_file::touch_ctime): Replace

View File

@ -332,12 +332,12 @@ static void
do_cleanup (void *args) do_cleanup (void *args)
{ {
# define cleanup ((pthread_cleanup *) args) # define cleanup ((pthread_cleanup *) args)
if (cleanup->oldint)
signal (SIGINT, cleanup->oldint);
if (cleanup->oldquit)
signal (SIGQUIT, cleanup->oldquit);
if (cleanup->oldmask != (sigset_t) -1) if (cleanup->oldmask != (sigset_t) -1)
sigprocmask (SIG_SETMASK, &(cleanup->oldmask), NULL); {
signal (SIGINT, cleanup->oldint);
signal (SIGQUIT, cleanup->oldquit);
sigprocmask (SIG_SETMASK, &(cleanup->oldmask), NULL);
}
# undef cleanup # undef cleanup
} }
@ -755,7 +755,6 @@ spawn_guts (const char * prog_arg, const char *const *argv,
int res; int res;
pthread_cleanup cleanup; pthread_cleanup cleanup;
pthread_cleanup_push (do_cleanup, (void *) &cleanup);
if (mode == _P_SYSTEM) if (mode == _P_SYSTEM)
{ {
sigset_t child_block; sigset_t child_block;
@ -765,6 +764,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
sigaddset (&child_block, SIGCHLD); sigaddset (&child_block, SIGCHLD);
(void) sigprocmask (SIG_BLOCK, &child_block, &cleanup.oldmask); (void) sigprocmask (SIG_BLOCK, &child_block, &cleanup.oldmask);
} }
pthread_cleanup_push (do_cleanup, (void *) &cleanup);
/* Fixup the parent data structures if needed and resume the child's /* Fixup the parent data structures if needed and resume the child's
main thread. */ main thread. */