mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 18:22:25 +02:00
commit bash-20100225 snapshot
This commit is contained in:
@@ -113,9 +113,6 @@ int trap_saved_exit_value;
|
||||
/* The (trapped) signal received while executing in the `wait' builtin */
|
||||
int wait_signal_received;
|
||||
|
||||
/* A value which can never be the target of a trap handler. */
|
||||
#define IMPOSSIBLE_TRAP_HANDLER (SigHandler *)initialize_traps
|
||||
|
||||
#define GETORIGSIG(sig) \
|
||||
do { \
|
||||
original_signals[sig] = (SigHandler *)set_signal_handler (sig, SIG_DFL); \
|
||||
@@ -265,6 +262,9 @@ run_pending_traps ()
|
||||
register int sig;
|
||||
int old_exit_value, *token_state;
|
||||
WORD_LIST *save_subst_varlist;
|
||||
#if defined (ARRAY_VARS)
|
||||
ARRAY *ps;
|
||||
#endif
|
||||
|
||||
if (catch_flag == 0) /* simple optimization */
|
||||
return;
|
||||
@@ -273,6 +273,9 @@ run_pending_traps ()
|
||||
|
||||
/* Preserve $? when running trap. */
|
||||
old_exit_value = last_command_exit_value;
|
||||
#if defined (ARRAY_VARS)
|
||||
ps = save_pipestatus_array ();
|
||||
#endif
|
||||
|
||||
for (sig = 1; sig < NSIG; sig++)
|
||||
{
|
||||
@@ -357,6 +360,9 @@ run_pending_traps ()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
restore_pipestatus_array (ps);
|
||||
#endif
|
||||
last_command_exit_value = old_exit_value;
|
||||
}
|
||||
|
||||
@@ -674,8 +680,14 @@ run_exit_trap ()
|
||||
{
|
||||
char *trap_command;
|
||||
int code, function_code, retval;
|
||||
#if defined (ARRAY_VARS)
|
||||
ARRAY *ps;
|
||||
#endif
|
||||
|
||||
trap_saved_exit_value = last_command_exit_value;
|
||||
#if defined (ARRAY_VARS)
|
||||
ps = save_pipestatus_array ();
|
||||
#endif
|
||||
function_code = 0;
|
||||
|
||||
/* Run the trap only if signal 0 is trapped and not ignored, and we are not
|
||||
@@ -715,6 +727,9 @@ run_exit_trap ()
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
restore_pipestatus_array (ps);
|
||||
#endif
|
||||
return (trap_saved_exit_value);
|
||||
}
|
||||
|
||||
@@ -737,6 +752,9 @@ _run_trap_internal (sig, tag)
|
||||
int save_return_catch_flag, function_code, flags;
|
||||
procenv_t save_return_catch;
|
||||
WORD_LIST *save_subst_varlist;
|
||||
#if defined (ARRAY_VARS)
|
||||
ARRAY *ps;
|
||||
#endif
|
||||
|
||||
trap_exit_value = function_code = 0;
|
||||
/* Run the trap only if SIG is trapped and not ignored, and we are not
|
||||
@@ -752,6 +770,9 @@ _run_trap_internal (sig, tag)
|
||||
|
||||
running_trap = sig + 1;
|
||||
trap_saved_exit_value = last_command_exit_value;
|
||||
#if defined (ARRAY_VARS)
|
||||
ps = save_pipestatus_array ();
|
||||
#endif
|
||||
|
||||
token_state = save_token_state ();
|
||||
save_subst_varlist = subst_assign_varlist;
|
||||
@@ -778,6 +799,9 @@ _run_trap_internal (sig, tag)
|
||||
|
||||
trap_exit_value = last_command_exit_value;
|
||||
last_command_exit_value = trap_saved_exit_value;
|
||||
#if defined (ARRAY_VARS)
|
||||
restore_pipestatus_array (ps);
|
||||
#endif
|
||||
running_trap = 0;
|
||||
|
||||
sigmodes[sig] &= ~SIG_INPROGRESS;
|
||||
@@ -888,7 +912,6 @@ run_interrupt_trap ()
|
||||
_run_trap_internal (SIGINT, "interrupt trap");
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_UNUSED
|
||||
/* Free all the allocated strings in the list of traps and reset the trap
|
||||
values to the default. Intended to be called from subshells that want
|
||||
to complete work done by reset_signal_handlers upon execution of a
|
||||
@@ -912,7 +935,6 @@ free_trap_string (sig)
|
||||
change_signal (sig, (char *)DEFAULT_SIG);
|
||||
sigmodes[sig] &= ~SIG_TRAPPED;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Reset the handler for SIG to the original value. */
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user