--
 builtins/wait.def |    4 +
 execute_cmd.c     |    8 +--
 jobs.c            |  111 ++++++++++++++++++++++++++++++++++++++++--------------
 jobs.h            |    2 
 shell.c           |    4 +
 sig.c             |   10 +++-
 sig.h             |    2 
 subst.c           |    4 -
 trap.c            |   41 +++++++++++++++----
 trap.h            |    5 +-
 10 files changed, 144 insertions(+), 47 deletions(-)

--- builtins/wait.def
+++ builtins/wait.def	2017-02-17 10:00:33.356335003 +0000
@@ -60,6 +60,7 @@ $END
 #include "bashgetopt.h"
 
 extern int wait_signal_received;
+extern int last_command_exit_signal;
 
 procenv_t wait_intr_buf;
 
@@ -72,6 +73,7 @@ procenv_t wait_intr_buf;
   do \
     { \
       interrupt_immediately = old_interrupt_immediately;\
+      wait_signal_received = 0; \
       return (s);\
     } \
   while (0)
@@ -103,7 +105,9 @@ wait_builtin (list)
   code = setjmp (wait_intr_buf);
   if (code)
     {
+      last_command_exit_signal = wait_signal_received;
       status = 128 + wait_signal_received;
+      wait_sigint_cleanup ();
       WAIT_RETURN (status);
     }
 
--- shell.c
+++ shell.c	2017-02-17 11:43:59.837193259 +0000
@@ -94,6 +94,7 @@ extern char *dist_version, *release_stat
 extern int patch_level, build_version;
 extern int shell_level;
 extern int subshell_environment;
+extern int running_in_background;
 extern int last_command_exit_value;
 extern int line_number;
 extern int expand_aliases;
@@ -1699,7 +1700,8 @@ shell_reinitialize ()
   /* Things that get 0. */
   login_shell = make_login_shell = interactive = executing = 0;
   debugging = do_version = line_number = last_command_exit_value = 0;
-  forced_interactive = interactive_shell = subshell_environment = 0;
+  forced_interactive = interactive_shell = 0;
+  subshell_environment = running_in_background = 0;
   expand_aliases = 0;
 
 #if defined (HISTORY)
--- execute_cmd.c
+++ execute_cmd.c	2017-02-17 15:08:19.736241748 +0000
@@ -1267,7 +1267,7 @@ execute_in_subshell (command, asynchrono
 
   reset_terminating_signals ();		/* in sig.c */
   /* Cancel traps, in trap.c. */
-  restore_original_signals ();
+  reset_signal_handlers ();
 
   /* Make sure restore_original_signals doesn't undo the work done by
      make_child to ensure that asynchronous children are immune to SIGINT
@@ -3006,7 +3006,7 @@ execute_simple_command (simple_command,
 	{
 	  /* reset_terminating_signals (); */	/* XXX */
 	  /* Cancel traps, in trap.c. */
-	  restore_original_signals ();
+	  reset_signal_handlers ();
 
 	  if (async)
 	    {
@@ -3597,10 +3597,10 @@ setup_async_signals ()
   if (job_control == 0)
 #endif
     {
+      get_original_signal (SIGINT);
       set_signal_handler (SIGINT, SIG_IGN);
-      set_signal_ignored (SIGINT);
+      get_original_signal (SIGQUIT);
       set_signal_handler (SIGQUIT, SIG_IGN);
-      set_signal_ignored (SIGQUIT);
     }
 }
 
--- jobs.c
+++ jobs.c	2017-02-17 12:40:12.846390477 +0000
@@ -208,6 +208,9 @@ PROCESS *the_pipeline = (PROCESS *)NULL;
 /* If this is non-zero, do job control. */
 int job_control = 1;
 
+/* Are we running in background? (terminal_pgrp != shell_pgrp) */
+int running_in_background = 0;
+
 /* Call this when you start making children. */
 int already_making_children = 0;
 
@@ -626,7 +629,6 @@ stop_pipeline (async, deferred)
       if (newjob)
 	{
 	  newjob->flags |= J_FOREGROUND;
-#if !defined(__linux__)
 	  /*
 	   *		!!!!! NOTE !!!!!  (chet@ins.cwru.edu)
 	   *
@@ -639,9 +641,8 @@ stop_pipeline (async, deferred)
 	   * subshell.
 	   *
 	   */
-	  if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
+	  if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0 && running_in_background == 0)
 	    give_terminal_to (newjob->pgrp, 0);
-#endif
 	}
     }
 
@@ -1763,7 +1764,7 @@ make_child (command, async_p)
 	     In this case, we don't want to give the terminal to the
 	     shell's process group (we could be in the middle of a
 	     pipeline, for example). */
-	  if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
+	  if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0) && running_in_background == 0)
 	    give_terminal_to (pipeline_pgrp, 0);
 
 #if defined (PGRP_PIPE)
@@ -2161,6 +2162,18 @@ wait_for_background_pids ()
 #define INVALID_SIGNAL_HANDLER (SigHandler *)wait_for_background_pids
 static SigHandler *old_sigint_handler = INVALID_SIGNAL_HANDLER;
 
+static int wait_sigint_received;
+static int child_caught_sigint;
+static int waiting_for_child;
+
+/* Clean up state after longjmp to wait_intr_buf */
+void
+wait_sigint_cleanup ()
+{
+  queue_sigchld = 0;
+  waiting_for_child = 0;
+}
+
 static void
 restore_sigint_handler ()
 {
@@ -2168,11 +2181,10 @@ restore_sigint_handler ()
     {
       set_signal_handler (SIGINT, old_sigint_handler);
       old_sigint_handler = INVALID_SIGNAL_HANDLER;
+      waiting_for_child = 0;
     }
 }
 
-static int wait_sigint_received;
-
 /* Handle SIGINT while we are waiting for children in a script to exit.
    The `wait' builtin should be interruptible, but all others should be
    effectively ignored (i.e. not cause the shell to exit). */
@@ -2185,7 +2197,7 @@ wait_sigint_handler (sig)
   if (interrupt_immediately ||
       (this_shell_builtin && this_shell_builtin == wait_builtin))
     {
-      last_command_exit_value = EXECUTION_FAILURE;
+      last_command_exit_value = 128+SIGINT;
       restore_sigint_handler ();
       /* If we got a SIGINT while in `wait', and SIGINT is trapped, do
 	 what POSIX.2 says (see builtins/wait.def for more info). */
@@ -2204,14 +2216,25 @@ wait_sigint_handler (sig)
 	    /* Let CHECK_WAIT_INTR handle it in wait_for/waitchld */
 	    SIGRETURN (0);
 	}
-      
-      ADDINTERRUPT;
-      QUIT;
+      else if (interrupt_immediately)
+      {
+        ADDINTERRUPT;
+	QUIT;
+      }
+      else /* wait_builtin but signal not trapped, treat as interrupt */
+        kill (getpid (), SIGINT);
     }
 
   /* XXX - should this be interrupt_state?  If it is, the shell will act
      as if it got the SIGINT interrupt. */
-  wait_sigint_received = 1;
+  if (waiting_for_child)
+    wait_sigint_received = 1;
+  else
+  {
+    last_command_exit_value = 128+SIGINT;
+    restore_sigint_handler ();
+    kill (getpid (), SIGINT);
+  }
 
   /* Otherwise effectively ignore the SIGINT and allow the running job to
      be killed. */
@@ -2345,10 +2368,11 @@ wait_for (pid)
      substitution. */
 
   /* This is possibly a race condition -- should it go in stop_pipeline? */
-  wait_sigint_received = 0;
+  wait_sigint_received = child_caught_sigint = 0;
   if (job_control == 0 || (subshell_environment&SUBSHELL_COMSUB))
     {
       old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
+      waiting_for_child = 0;
       if (old_sigint_handler == SIG_IGN)
 	set_signal_handler (SIGINT, old_sigint_handler);
     }
@@ -2367,7 +2391,8 @@ wait_for (pid)
   job = NO_JOB;
   do
     {
-      FIND_CHILD (pid, child);
+      if (pid != (pid_t)-1)
+        FIND_CHILD (pid, child);
 
       /* If this child is part of a job, then we are really waiting for the
 	 job to finish.  Otherwise, we are waiting for the child to finish.
@@ -2380,7 +2405,7 @@ wait_for (pid)
 	 has already exited before this is called, sigchld_handler will have
 	 called waitchld and the state will be set to JDEAD. */
 
-      if (PRUNNING(child) || (job != NO_JOB && RUNNING (job)))
+      if (pid == (pid_t)-1 || PRUNNING(child) || (job != NO_JOB && RUNNING (job)))
 	{
 #if defined (WAITPID_BROKEN)    /* SCOv4 */
 	  sigset_t suspend_set;
@@ -2405,7 +2430,9 @@ wait_for (pid)
 	  sigaction (SIGCHLD, &act, &oact);
 #  endif
 	  queue_sigchld = 1;
+	  waiting_for_child++;
 	  r = waitchld (pid, 1);
+	  waiting_for_child--;
 #  if defined (MUST_UNBLOCK_CHLD)
 	  sigaction (SIGCHLD, &oact, (struct sigaction *)NULL);
 	  sigprocmask (SIG_SETMASK, &chldset, (sigset_t *)NULL);
@@ -2423,8 +2450,11 @@ wait_for (pid)
 	     if it exists, as JDEAD. */
 	  if (r == -1 && errno == ECHILD)
 	    {
-	      child->running = PS_DONE;
-	      child->status = 0;	/* XXX -- can't find true status */
+	      if (child)
+	        {
+		  child->running = PS_DONE;
+		  child->status = 0;	/* XXX -- can't find true status */
+	        }
 	      js.c_living = 0;		/* no living child processes */
 	      if (job != NO_JOB)
 		{
@@ -2432,6 +2462,11 @@ wait_for (pid)
 		  js.c_reaped++;
 		  js.j_ndead++;
 		}
+	      if (pid == (pid_t)-1)
+	        {
+		  termination_state = -1;
+		  break;
+		}
 	    }
 #endif /* WAITPID_BROKEN */
 	}
@@ -2445,9 +2480,17 @@ wait_for (pid)
 
       /* Check for a trapped signal interrupting the wait builtin and jump out */
       CHECK_WAIT_INTR;
+
+      if (pid == (pid_t)-1)
+	/* XXX - could set child but we don't have a handle on what waitchld
+	   reaps.  Leave termination_state alone. */
+	goto wait_for_return;
     }
   while (PRUNNING (child) || (job != NO_JOB && RUNNING (job)));
 
+  /* Restore the original SIGINT signal handler before we return. */
+  restore_sigint_handler ();
+
   /* The exit state of the command is either the termination state of the
      child, or the termination state of the job.  If a job, the status
      of the last child in the pipeline is the significant one.  If the command
@@ -2480,7 +2523,8 @@ wait_for (pid)
 if (job == NO_JOB)
   itrace("wait_for: job == NO_JOB, giving the terminal to shell_pgrp (%ld)", (long)shell_pgrp);
 #endif
-      give_terminal_to (shell_pgrp, 0);
+      if (running_in_background == 0 && (subshell_environment&(SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
+	give_terminal_to (shell_pgrp, 0);
     }
 
   /* If the command did not exit cleanly, or the job is just
@@ -2536,17 +2580,15 @@ if (job == NO_JOB)
 		}
 	    }
 	}
-      else if ((subshell_environment & SUBSHELL_COMSUB) && wait_sigint_received)
+      else if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PIPE)) && wait_sigint_received)
 	{
 	  /* If waiting for a job in a subshell started to do command
 	     substitution, simulate getting and being killed by the SIGINT to
 	     pass the status back to our parent. */
-	  s = job_signal_status (job);
 	
-	  if (WIFSIGNALED (s) && WTERMSIG (s) == SIGINT && signal_is_trapped (SIGINT) == 0)
+	  if (child_caught_sigint == 0 && signal_is_trapped (SIGINT) == 0)
 	    {
 	      UNBLOCK_CHILD (oset);
-	      restore_sigint_handler ();
 	      old_sigint_handler = set_signal_handler (SIGINT, SIG_DFL);
 	      if (old_sigint_handler == SIG_IGN)
 		restore_sigint_handler ();
@@ -2572,9 +2614,6 @@ wait_for_return:
 
   UNBLOCK_CHILD (oset);
 
-  /* Restore the original SIGINT signal handler before we return. */
-  restore_sigint_handler ();
-
   return (termination_state);
 }
 
@@ -3071,9 +3110,18 @@ waitchld (wpid, block)
       CHECK_TERMSIG;
       CHECK_WAIT_INTR;
 
+      if (pid < 0 && errno == EINTR && wait_sigint_received)
+	child_caught_sigint = 1;
+
       if (pid <= 0)
 	continue;	/* jumps right to the test */
 
+      if (wait_sigint_received && (WIFSIGNALED (status) == 0 || WTERMSIG (status) != SIGINT))
+	  child_caught_sigint = 1;
+
+      if (WIFSIGNALED (status) && WTERMSIG (status) == SIGINT)
+	  child_caught_sigint = 0;
+
       /* children_exited is used to run traps on SIGCHLD.  We don't want to
          run the trap if a process is just being continued. */
       if (WIFCONTINUED(status) == 0)
@@ -3126,7 +3174,8 @@ 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 &&
+  if (job_control && children_exited &&
+	  (signal_is_trapped (SIGCHLD) || trap_list[SIGCHLD] == (char *)initialize_traps) &&
       trap_list[SIGCHLD] != (char *)IGNORE_SIG)
     {
       if (posixly_correct && this_shell_builtin && this_shell_builtin == wait_builtin)
@@ -3267,7 +3316,7 @@ set_job_status_and_cleanup (job)
 	 does not exit due to SIGINT, run the trap handler but do not
 	 otherwise act as if we got the interrupt. */
       if (wait_sigint_received && interactive_shell == 0 &&
-	  WIFSIGNALED (child->status) == 0 && IS_FOREGROUND (job) &&
+	  child_caught_sigint && IS_FOREGROUND (job) &&
 	  signal_is_trapped (SIGINT))
 	{
 	  int old_frozen;
@@ -3289,7 +3338,8 @@ set_job_status_and_cleanup (job)
 	 signals are sent to process groups) or via kill(2) to the foreground
 	 process by another process (or itself).  If the shell did receive the
 	 SIGINT, it needs to perform normal SIGINT processing. */
-      else if (wait_sigint_received && (WTERMSIG (child->status) == SIGINT) &&
+      else if (wait_sigint_received &&
+	      child_caught_sigint == 0 &&
 	      IS_FOREGROUND (job) && IS_JOBCONTROL (job) == 0)
 	{
 	  int old_frozen;
@@ -3648,6 +3698,8 @@ initialize_job_control (force)
 	internal_error (_("no job control in this shell"));
     }
 
+  running_in_background = terminal_pgrp != shell_pgrp;
+
   if (shell_tty != fileno (stderr))
     SET_CLOSE_ON_EXEC (shell_tty);
 
@@ -4066,6 +4118,11 @@ set_job_control (arg)
   old = job_control;
   job_control = arg;
 
+  if (terminal_pgrp == NO_PID)
+    terminal_pgrp = tcgetpgrp (shell_tty);
+
+  running_in_background = (terminal_pgrp != shell_pgrp);
+
   /* If we're turning on job control, reset pipeline_pgrp so make_child will
      put new child processes into the right pgrp */
   if (job_control != old && job_control)
--- jobs.h
+++ jobs.h	2017-02-17 09:50:26.637923588 +0000
@@ -210,6 +210,8 @@ extern void wait_for_background_pids __P
 extern int wait_for __P((pid_t));
 extern int wait_for_job __P((int));
 
+extern void wait_sigint_cleanup __P((void));
+
 extern void notify_and_cleanup __P((void));
 extern void reap_dead_jobs __P((void));
 extern int start_job __P((int, int));
--- trap.h
+++ trap.h	2017-02-17 15:11:19.490257777 +0000
@@ -86,10 +86,13 @@ extern void free_trap_strings __P((void)
 extern void reset_signal_handlers __P((void));
 extern void restore_original_signals __P((void));
 
+extern void get_original_signal __P((int));
+extern void get_all_original_signals __P((void));
+
 extern char *signal_name __P((int));
 
 extern int decode_signal __P((char *, int));
-extern void run_interrupt_trap __P((void));
+extern void run_interrupt_trap __P((int));
 extern int maybe_call_trap_handler __P((int));
 extern int signal_is_trapped __P((int));
 extern int signal_is_ignored __P((int));
--- trap.c
+++ trap.c	2017-02-17 15:12:10.914834785 +0000
@@ -70,8 +70,6 @@ static int sigmodes[BASH_NSIG];
 static void free_trap_command __P((int));
 static void change_signal __P((int, char *));
 
-static void get_original_signal __P((int));
-
 static int _run_trap_internal __P((int, char *));
 
 static void reset_signal __P((int));
@@ -265,7 +263,7 @@ void
 run_pending_traps ()
 {
   register int sig;
-  int old_exit_value, *token_state;
+  int old_exit_value, *token_state, x;
 
   if (catch_flag == 0)		/* simple optimization */
     return;
@@ -288,12 +286,15 @@ run_pending_traps ()
 	 while (pending_traps[sig]--) instead of the if statement. */
       if (pending_traps[sig])
 	{
+	  if (running_trap == sig+1)
+	    /*continue*/;
+
 	  running_trap = sig + 1;
 
 	  if (sig == SIGINT)
 	    {
 	      pending_traps[sig] = 0;	/* XXX */
-	      run_interrupt_trap ();
+	      run_interrupt_trap (0);
 	      CLRINTERRUPT;
 	    }
 #if defined (JOB_CONTROL) && defined (SIGCHLD)
@@ -302,8 +303,11 @@ run_pending_traps ()
 		   (sigmodes[SIGCHLD] & SIG_INPROGRESS) == 0)
 	    {
 	      sigmodes[SIGCHLD] |= SIG_INPROGRESS;
-	      run_sigchld_trap (pending_traps[sig]);	/* use as counter */
+	      x = pending_traps[sig];
+	      pending_traps[sig] = 0;
+	      run_sigchld_trap (x);	/* use as counter */
 	      sigmodes[SIGCHLD] &= ~SIG_INPROGRESS;
+	      continue;
 	    }
 	  else if (sig == SIGCHLD &&
 		   trap_list[SIGCHLD] == (char *)IMPOSSIBLE_TRAP_HANDLER &&
@@ -351,7 +355,9 @@ run_pending_traps ()
 	  else
 	    {
 	      token_state = save_token_state ();
+	      save_pipeline (1);
 	      parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST);
+	      restore_pipeline (1);
 	      restore_token_state (token_state);
 	      free (token_state);
 	    }
@@ -542,6 +548,8 @@ set_signal (sig, string)
      int sig;
      char *string;
 {
+  sigset_t set, oset;
+
   if (SPECIAL_TRAP (sig))
     {
       change_signal (sig, savestring (string));
@@ -572,9 +580,10 @@ set_signal (sig, string)
      environment in which it is safe to do so. */
   if ((sigmodes[sig] & SIG_NO_TRAP) == 0)
     {
-      set_signal_handler (sig, SIG_IGN);
+      BLOCK_SIGNAL (sig, set, oset);
       change_signal (sig, savestring (string));
       set_signal_handler (sig, trap_handler);
+      UNBLOCK_SIGNAL (oset);
     }
   else
     change_signal (sig, savestring (string));
@@ -611,15 +620,24 @@ change_signal (sig, value)
     sigmodes[sig] |= SIG_CHANGED;
 }
 
-static void
+void
 get_original_signal (sig)
      int sig;
 {
   /* If we aren't sure the of the original value, then get it. */
-  if (original_signals[sig] == (SigHandler *)IMPOSSIBLE_TRAP_HANDLER)
+  if (sig > 0 && sig < NSIG && original_signals[sig] == (SigHandler *)IMPOSSIBLE_TRAP_HANDLER)
     GETORIGSIG (sig);
 }
 
+void
+get_all_original_signals ()
+{
+  register int i;
+
+  for (i = 1; i < NSIG; i++)
+    GET_ORIGINAL_SIGNAL (i);
+}
+
 /* Restore the default action for SIG; i.e., the action the shell
    would have taken before you used the trap command.  This is called
    from trap_builtin (), which takes care to restore the handlers for
@@ -901,8 +919,11 @@ run_return_trap ()
 /* Run a trap set on SIGINT.  This is called from throw_to_top_level (), and
    declared here to localize the trap functions. */
 void
-run_interrupt_trap ()
+run_interrupt_trap (will_throw)
+    int will_throw;	/* from throw_to_top_level? */
 {
+  if (will_throw && running_trap > 0)
+    run_trap_cleanup (running_trap - 1);
   _run_trap_internal (SIGINT, "interrupt trap");
 }
 
@@ -1017,7 +1038,7 @@ maybe_call_trap_handler (sig)
       switch (sig)
 	{
 	case SIGINT:
-	  run_interrupt_trap ();
+	  run_interrupt_trap (0);
 	  break;
 	case EXIT_TRAP:
 	  run_exit_trap ();
--- sig.c
+++ sig.c	2017-02-17 10:24:27.571566453 +0000
@@ -58,6 +58,7 @@ extern int last_command_exit_value;
 extern int last_command_exit_signal;
 extern int return_catch_flag;
 extern int loop_level, continuing, breaking;
+extern int running_trap;
 extern int parse_and_execute_level, shell_initialized;
 extern int wait_signal_received;
 extern sh_builtin_func_t *this_shell_builtin;
@@ -381,6 +382,8 @@ throw_to_top_level ()
 
   if (interrupt_state)
     {
+      if (last_command_exit_value < 128)
+	last_command_exit_value = 128 + SIGINT;
       print_newline = 1;
       DELINTERRUPT;
     }
@@ -393,12 +396,15 @@ throw_to_top_level ()
   last_command_exit_value |= 128;
 
   /* Run any traps set on SIGINT. */
-  run_interrupt_trap ();
+  if (signal_is_trapped (SIGINT))
+    run_interrupt_trap (1);
 
   /* Cleanup string parser environment. */
   while (parse_and_execute_level)
     parse_and_execute_cleanup ();
 
+  if (running_trap > 0)
+    run_trap_cleanup (running_trap - 1);
 #if defined (JOB_CONTROL)
   give_terminal_to (shell_pgrp, 0);
 #endif /* JOB_CONTROL */
@@ -520,7 +526,7 @@ termsig_handler (sig)
 
   /* I don't believe this condition ever tests true. */
   if (sig == SIGINT && signal_is_trapped (SIGINT))
-    run_interrupt_trap ();
+    run_interrupt_trap (0);
 
 #if defined (HISTORY)
   if (interactive_shell && sig != SIGABRT)
--- subst.c
+++ subst.c	2017-02-17 11:46:04.510527621 +0000
@@ -136,7 +136,7 @@ unsigned char ifs_firstc;
 
 /* Extern functions and variables from different files. */
 extern int last_command_exit_value, last_command_exit_signal;
-extern int subshell_environment;
+extern int subshell_environment, running_in_background;
 extern int subshell_level, parse_and_execute_level;
 extern int eof_encountered;
 extern int return_catch_flag, return_catch_value;
@@ -4750,7 +4750,7 @@ command_substitute (string, quoted)
 #if 0
       if (interactive && pipeline_pgrp != (pid_t)0 && pipeline_pgrp != last_asynchronous_pid)
 #else
-      if (interactive && pipeline_pgrp != (pid_t)0 && (subshell_environment & SUBSHELL_ASYNC) == 0)
+      if (interactive && pipeline_pgrp != (pid_t)0 && (subshell_environment & SUBSHELL_ASYNC) == 0 && running_in_background == 0)
 #endif
 	give_terminal_to (pipeline_pgrp, 0);
 #endif /* JOB_CONTROL */
--- sig.h
+++ sig.h	2017-02-17 12:49:51.625004848 +0000
@@ -96,6 +96,8 @@ do { \
   sigprocmask (SIG_BLOCK, &nvar, &ovar); \
 } while (0)
 
+#define UNBLOCK_SIGNAL(ovar) sigprocmask (SIG_SETMASK, &ovar, (sigset_t *) NULL)
+
 #if defined (HAVE_POSIX_SIGNALS)
 #  define BLOCK_CHILD(nvar, ovar) \
 	BLOCK_SIGNAL (SIGCHLD, nvar, ovar)
