]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
Bash-5.0 patch 7: fix exec builtin leaving the terminal in the wrong process group
authorChet Ramey <chet.ramey@case.edu>
Sat, 20 Apr 2019 18:27:56 +0000 (14:27 -0400)
committerChet Ramey <chet.ramey@case.edu>
Sat, 20 Apr 2019 18:27:56 +0000 (14:27 -0400)
jobs.c
patchlevel.h

diff --git a/jobs.c b/jobs.c
index ae3c54c6dcf2f4d64ac76dbaeeaf6ff3595632dd..6bc31dca14dd0cce7dfeaa6c40e890a1c6dfc0d0 100644 (file)
--- a/jobs.c
+++ b/jobs.c
@@ -4837,15 +4837,13 @@ void
 end_job_control ()
 {
   if (job_control)
-    {
-      terminate_stopped_jobs ();
+    terminate_stopped_jobs ();
 
-      if (original_pgrp >= 0)
-       give_terminal_to (original_pgrp, 1);
-    }
+  if (original_pgrp >= 0 && terminal_pgrp != original_pgrp)
+    give_terminal_to (original_pgrp, 1);
 
-  if (original_pgrp >= 0)
-    setpgid (0, original_pgrp);
+  if (original_pgrp >= 0 && setpgid (0, original_pgrp) == 0)
+    shell_pgrp = original_pgrp;
 }
 
 /* Restart job control by closing shell tty and reinitializing.  This is
index 14bff9fc9b90c57e2f58dd403bfcb992576943f2..deb9c5b74a5b0029aa4d05c25dd32d4ae378000b 100644 (file)
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 6
+#define PATCHLEVEL 7
 
 #endif /* _PATCHLEVEL_H_ */