nalika / rpms / bash

Forked from rpms/bash 2 years ago
Clone
aa5cbc
diff --git a/execute_cmd.c b/execute_cmd.c
aa5cbc
--- a/execute_cmd.c
aa5cbc
+++ b/execute_cmd.c
aa5cbc
@@ -536,6 +536,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
aa5cbc
   REDIRECT *my_undo_list, *exec_undo_list;
aa5cbc
   volatile int last_pid;
aa5cbc
   volatile int save_line_number;
aa5cbc
+#if defined (PROCESS_SUBSTITUTION)
aa5cbc
+  volatile int ofifo, nfifo, osize, saved_fifo;
aa5cbc
+  volatile char *ofifo_list = NULL;
aa5cbc
+#endif
aa5cbc
 
aa5cbc
 #if 0
aa5cbc
   if (command == 0 || breaking || continuing || read_but_dont_execute)
aa5cbc
@@ -681,6 +685,17 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
aa5cbc
   if (shell_control_structure (command->type) && command->redirects)
aa5cbc
     stdin_redir = stdin_redirects (command->redirects);
aa5cbc
 
aa5cbc
+#if defined (PROCESS_SUBSTITUTION)
aa5cbc
+  if (variable_context != 0)
aa5cbc
+    {
aa5cbc
+      ofifo = num_fifos ();
aa5cbc
+      ofifo_list = copy_fifo_list ((int*)&osize);
aa5cbc
+      saved_fifo = 1;
aa5cbc
+    }
aa5cbc
+  else
aa5cbc
+    saved_fifo = 0;
aa5cbc
+#endif
aa5cbc
+
aa5cbc
   /* Handle WHILE FOR CASE etc. with redirections.  (Also '&' input
aa5cbc
      redirection.)  */
aa5cbc
   if (do_redirections (command->redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
aa5cbc
@@ -688,6 +703,9 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
aa5cbc
       cleanup_redirects (redirection_undo_list);
aa5cbc
       redirection_undo_list = (REDIRECT *)NULL;
aa5cbc
       dispose_exec_redirects ();
aa5cbc
+#if defined (PROCESS_SUBSTITUTION)
aa5cbc
+      free ((void*)ofifo_list);
aa5cbc
+#endif
aa5cbc
       return (last_command_exit_value = EXECUTION_FAILURE);
aa5cbc
     }
aa5cbc
 
aa5cbc
@@ -982,6 +1000,17 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
aa5cbc
   if (my_undo_list || exec_undo_list)
aa5cbc
     discard_unwind_frame ("loop_redirections");
aa5cbc
 
aa5cbc
+#if defined (PROCESS_SUBSTITUTION)
aa5cbc
+  if (saved_fifo)
aa5cbc
+    {
aa5cbc
+      nfifo = num_fifos ();
aa5cbc
+      if (nfifo > ofifo)
aa5cbc
+       close_new_fifos ((char*)ofifo_list, osize);
aa5cbc
+      free ((void*)ofifo_list);
aa5cbc
+    }
aa5cbc
+#endif
aa5cbc
+
aa5cbc
+
aa5cbc
   /* Invert the return value if we have to */
aa5cbc
   if (invert)
aa5cbc
     exec_result = (exec_result == EXECUTION_SUCCESS)