summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2019-04-20 14:27:56 -0400
committerChet Ramey <chet.ramey@case.edu>2019-04-20 14:27:56 -0400
commit3ba697465bc74fab513a26dea700cc82e9f4724e (patch)
tree0da0bf01cb4b51d2f769dca0a62d21ce4d5f13c5
parentdfd2cc6ac5558e252af0a7cb829a9629bf782e17 (diff)
downloadbash-3ba697465bc74fab513a26dea700cc82e9f4724e.tar.gz
Bash-5.0 patch 7: fix exec builtin leaving the terminal in the wrong process group
-rw-r--r--jobs.c12
-rw-r--r--patchlevel.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/jobs.c b/jobs.c
index ae3c54c6..6bc31dca 100644
--- 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
diff --git a/patchlevel.h b/patchlevel.h
index 14bff9fc..deb9c5b7 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -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_ */