|
|
e6eb8e |
From 2fb21d75bfddd724b0e45d4a51455a166467e496 Mon Sep 17 00:00:00 2001
|
|
|
e6eb8e |
From: Chet Ramey <chet.ramey@case.edu>
|
|
|
e6eb8e |
Date: Mon, 29 Jan 2018 16:03:47 -0500
|
|
|
e6eb8e |
Subject: [PATCH] Bash-4.4 patch 14
|
|
|
e6eb8e |
|
|
|
e6eb8e |
---
|
|
|
e6eb8e |
execute_cmd.c | 19 ++++++++++++++++---
|
|
|
e6eb8e |
patchlevel.h | 2 +-
|
|
|
e6eb8e |
2 files changed, 17 insertions(+), 4 deletions(-)
|
|
|
e6eb8e |
|
|
|
e6eb8e |
diff --git a/execute_cmd.c b/execute_cmd.c
|
|
|
e6eb8e |
index 2a3df6d6..76a80766 100644
|
|
|
e6eb8e |
--- a/execute_cmd.c
|
|
|
e6eb8e |
+++ b/execute_cmd.c
|
|
|
e6eb8e |
@@ -726,6 +726,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
|
e6eb8e |
{
|
|
|
e6eb8e |
ofifo = num_fifos ();
|
|
|
e6eb8e |
ofifo_list = copy_fifo_list ((int *)&osize);
|
|
|
e6eb8e |
+ begin_unwind_frame ("internal_fifos");
|
|
|
e6eb8e |
+ add_unwind_protect (xfree, ofifo_list);
|
|
|
e6eb8e |
saved_fifo = 1;
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
else
|
|
|
e6eb8e |
@@ -741,7 +743,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
|
e6eb8e |
dispose_exec_redirects ();
|
|
|
e6eb8e |
#if defined (PROCESS_SUBSTITUTION)
|
|
|
e6eb8e |
if (saved_fifo)
|
|
|
e6eb8e |
- free ((void *)ofifo_list);
|
|
|
e6eb8e |
+ {
|
|
|
e6eb8e |
+ free ((void *)ofifo_list);
|
|
|
e6eb8e |
+ discard_unwind_frame ("internal_fifos");
|
|
|
e6eb8e |
+ }
|
|
|
e6eb8e |
#endif
|
|
|
e6eb8e |
return (last_command_exit_value = EXECUTION_FAILURE);
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
@@ -1060,6 +1065,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
|
|
|
e6eb8e |
if (nfifo > ofifo)
|
|
|
e6eb8e |
close_new_fifos ((char *)ofifo_list, osize);
|
|
|
e6eb8e |
free ((void *)ofifo_list);
|
|
|
e6eb8e |
+ discard_unwind_frame ("internal_fifos");
|
|
|
e6eb8e |
}
|
|
|
e6eb8e |
#endif
|
|
|
e6eb8e |
|
|
|
e6eb8e |
@@ -4977,9 +4983,14 @@ execute_builtin_or_function (words, builtin, var, redirects,
|
|
|
e6eb8e |
char *ofifo_list;
|
|
|
e6eb8e |
#endif
|
|
|
e6eb8e |
|
|
|
e6eb8e |
-#if defined (PROCESS_SUBSTITUTION)
|
|
|
e6eb8e |
+#if defined (PROCESS_SUBSTITUTION)
|
|
|
e6eb8e |
+ begin_unwind_frame ("saved_fifos");
|
|
|
e6eb8e |
+ /* If we return, we longjmp and don't get a chance to restore the old
|
|
|
e6eb8e |
+ fifo list, so we add an unwind protect to free it */
|
|
|
e6eb8e |
ofifo = num_fifos ();
|
|
|
e6eb8e |
ofifo_list = copy_fifo_list (&osize);
|
|
|
e6eb8e |
+ if (ofifo_list)
|
|
|
e6eb8e |
+ add_unwind_protect (xfree, ofifo_list);
|
|
|
e6eb8e |
#endif
|
|
|
e6eb8e |
|
|
|
e6eb8e |
if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
|
|
|
e6eb8e |
@@ -5063,7 +5074,9 @@ execute_builtin_or_function (words, builtin, var, redirects,
|
|
|
e6eb8e |
nfifo = num_fifos ();
|
|
|
e6eb8e |
if (nfifo > ofifo)
|
|
|
e6eb8e |
close_new_fifos (ofifo_list, osize);
|
|
|
e6eb8e |
- free (ofifo_list);
|
|
|
e6eb8e |
+ if (ofifo_list)
|
|
|
e6eb8e |
+ free (ofifo_list);
|
|
|
e6eb8e |
+ discard_unwind_frame ("saved_fifos");
|
|
|
e6eb8e |
#endif
|
|
|
e6eb8e |
|
|
|
e6eb8e |
return (result);
|
|
|
e6eb8e |
diff --git a/patchlevel.h b/patchlevel.h
|
|
|
e6eb8e |
index 779671cd..09a3cc84 100644
|
|
|
e6eb8e |
--- a/patchlevel.h
|
|
|
e6eb8e |
+++ b/patchlevel.h
|
|
|
e6eb8e |
@@ -25,6 +25,6 @@
|
|
|
e6eb8e |
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
|
|
e6eb8e |
looks for to find the patch level (for the sccs version string). */
|
|
|
e6eb8e |
|
|
|
e6eb8e |
-#define PATCHLEVEL 13
|
|
|
e6eb8e |
+#define PATCHLEVEL 14
|
|
|
e6eb8e |
|
|
|
e6eb8e |
#endif /* _PATCHLEVEL_H_ */
|
|
|
e6eb8e |
--
|
|
|
e6eb8e |
2.13.6
|
|
|
e6eb8e |
|