From ed35cb4a6394a5121724fc8a2c0ace6eb5be9de1 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Wed, 7 Dec 2011 09:24:27 -0500 Subject: commit bash-20080529 snapshot --- jobs.c~ | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'jobs.c~') diff --git a/jobs.c~ b/jobs.c~ index 1414bc46..ce6305ac 100644 --- a/jobs.c~ +++ b/jobs.c~ @@ -217,8 +217,6 @@ int check_window_size; /* Functions local to this file. */ -static void run_sigchld_trap __P((int)); - static sighandler wait_sigint_handler __P((int)); static sighandler sigchld_handler __P((int)); static sighandler sigcont_sighandler __P((int)); @@ -2214,6 +2212,7 @@ wait_sigint_handler (sig) /* XXX - should this be interrupt_state? If it is, the shell will act as if it got the SIGINT interrupt. */ wait_sigint_received = 1; + /* Otherwise effectively ignore the SIGINT and allow the running job to be killed. */ SIGRETURN (0); @@ -3122,7 +3121,17 @@ waitchld (wpid, block) /* Call a SIGCHLD trap handler for each child that exits, if one is set. */ if (job_control && signal_is_trapped (SIGCHLD) && children_exited && trap_list[SIGCHLD] != (char *)IGNORE_SIG) - run_sigchld_trap (children_exited); + { + if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin) + { + interrupt_immediately = 0; + trap_handler (SIGCHLD); /* set pending_traps[SIGCHLD] */ + wait_signal_received = SIGCHLD; + longjmp (wait_intr_buf, 1); + } + + run_sigchld_trap (children_exited); + } /* We have successfully recorded the useful information about this process that has just changed state. If we notify asynchronously, and the job @@ -3341,7 +3350,7 @@ setjstatus (j) #endif } -static void +void run_sigchld_trap (nchild) int nchild; { @@ -3372,7 +3381,7 @@ run_sigchld_trap (nchild) subst_assign_varlist = (WORD_LIST *)NULL; the_pipeline = (PROCESS *)NULL; - restore_default_signal (SIGCHLD); + set_impossible_sigchld_trap (); jobs_list_frozen = 1; for (i = 0; i < nchild; i++) { -- cgit v1.2.1