commit bash-20180413 snapshot

This commit is contained in:
Chet Ramey
2018-04-16 16:35:50 -04:00
parent d155fbc5fd
commit 89149ec09e
15 changed files with 201 additions and 31 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ extern WORD_LIST *get_directory_stack __P((int));
/* Functions from evalstring.c */
extern int parse_and_execute __P((char *, const char *, int));
extern int evalstring __P((char *, const char *, int));
extern void parse_and_execute_cleanup __P((void));
extern void parse_and_execute_cleanup __P((int));
extern int parse_string __P((char *, const char *, int, char **));
extern int should_suppress_fork __P((COMMAND *));
extern void optimize_fork __P((COMMAND *));
+1 -1
View File
@@ -278,7 +278,7 @@ file_error_and_exit:
force parse_and_execute () to clean up. */
if (return_val)
{
parse_and_execute_cleanup ();
parse_and_execute_cleanup (-1);
result = return_catch_value;
}
else
+16 -4
View File
@@ -136,11 +136,17 @@ optimize_subshell_command (command)
/* How to force parse_and_execute () to clean up after itself. */
void
parse_and_execute_cleanup ()
parse_and_execute_cleanup (old_running_trap)
int old_running_trap;
{
if (running_trap)
if (running_trap > 0)
{
run_trap_cleanup (running_trap - 1);
/* We assume if we have a different value for running_trap than when
we started (the only caller that cares is evalstring()), the
original caller will perform the cleanup, and we should not step
on them. */
if (running_trap != old_running_trap)
run_trap_cleanup (running_trap - 1);
unfreeze_jobs_list ();
}
@@ -653,6 +659,10 @@ evalstring (string, from_file, flags)
int flags;
{
volatile int r, rflag, rcatch;
volatile int was_trap;
/* Are we running a trap when we execute this function? */
was_trap = running_trap;
rcatch = 0;
rflag = return_catch_flag;
@@ -672,7 +682,9 @@ evalstring (string, from_file, flags)
if (rcatch)
{
parse_and_execute_cleanup ();
/* We care about whether or not we are running the same trap we were
when we entered this function. */
parse_and_execute_cleanup (was_trap);
r = return_catch_value;
}
else