psss / rpms / bash

Forked from rpms/bash 6 years ago
Clone
1bf46ca
From 2965eca924466a48c5597ac5c6c86d470e718908 Mon Sep 17 00:00:00 2001
1bf46ca
From: Chet Ramey <chet.ramey@case.edu>
1bf46ca
Date: Mon, 14 Nov 2016 14:27:35 -0500
1bf46ca
Subject: [PATCH] Bash-4.4 patch 4
1bf46ca
1bf46ca
---
1bf46ca
 jobs.c       | 15 +++++++++++++++
1bf46ca
 jobs.h       |  1 +
1bf46ca
 patchlevel.h |  2 +-
1bf46ca
 subst.c      |  5 +----
1bf46ca
 4 files changed, 18 insertions(+), 5 deletions(-)
1bf46ca
1bf46ca
diff --git a/jobs.c b/jobs.c
1bf46ca
index cef3c79..fc96603 100644
1bf46ca
--- a/jobs.c
1bf46ca
+++ b/jobs.c
1bf46ca
@@ -453,6 +453,21 @@ cleanup_the_pipeline ()
1bf46ca
     discard_pipeline (disposer);
1bf46ca
 }
1bf46ca
 
1bf46ca
+void
1bf46ca
+discard_last_procsub_child ()
1bf46ca
+{
1bf46ca
+  PROCESS *disposer;
1bf46ca
+  sigset_t set, oset;
1bf46ca
+
1bf46ca
+  BLOCK_CHILD (set, oset);
1bf46ca
+  disposer = last_procsub_child;
1bf46ca
+  last_procsub_child = (PROCESS *)NULL;
1bf46ca
+  UNBLOCK_CHILD (oset);
1bf46ca
+
1bf46ca
+  if (disposer)
1bf46ca
+    discard_pipeline (disposer);
1bf46ca
+}
1bf46ca
+
1bf46ca
 struct pipeline_saver *
1bf46ca
 alloc_pipeline_saver ()
1bf46ca
 {
1bf46ca
diff --git a/jobs.h b/jobs.h
1bf46ca
index 4ba3513..6df0607 100644
1bf46ca
--- a/jobs.h
1bf46ca
+++ b/jobs.h
1bf46ca
@@ -190,6 +190,7 @@ extern JOB **jobs;
1bf46ca
 extern void making_children __P((void));
1bf46ca
 extern void stop_making_children __P((void));
1bf46ca
 extern void cleanup_the_pipeline __P((void));
1bf46ca
+extern void discard_last_procsub_child __P((void));
1bf46ca
 extern void save_pipeline __P((int));
1bf46ca
 extern PROCESS *restore_pipeline __P((int));
1bf46ca
 extern void start_pipeline __P((void));
1bf46ca
diff --git a/patchlevel.h b/patchlevel.h
1bf46ca
index e7e960c..c059f0b 100644
1bf46ca
--- a/patchlevel.h
1bf46ca
+++ b/patchlevel.h
1bf46ca
@@ -25,6 +25,6 @@
1bf46ca
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
1bf46ca
    looks for to find the patch level (for the sccs version string). */
1bf46ca
 
1bf46ca
-#define PATCHLEVEL 3
1bf46ca
+#define PATCHLEVEL 4
1bf46ca
 
1bf46ca
 #endif /* _PATCHLEVEL_H_ */
1bf46ca
diff --git a/subst.c b/subst.c
1bf46ca
index 4d498ef..298187d 100644
1bf46ca
--- a/subst.c
1bf46ca
+++ b/subst.c
1bf46ca
@@ -5808,10 +5808,7 @@ process_substitute (string, open_for_read_in_child)
1bf46ca
     {
1bf46ca
 #if defined (JOB_CONTROL)
1bf46ca
       if (last_procsub_child)
1bf46ca
-	{
1bf46ca
-	  discard_pipeline (last_procsub_child);
1bf46ca
-	  last_procsub_child = (PROCESS *)NULL;
1bf46ca
-	}
1bf46ca
+	discard_last_procsub_child ();
1bf46ca
       last_procsub_child = restore_pipeline (0);
1bf46ca
 #endif
1bf46ca
 
1bf46ca
-- 
1bf46ca
2.9.3
1bf46ca