summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <[email protected]>2024-08-01 11:33:15 -0400
committerChet Ramey <[email protected]>2024-08-01 11:33:15 -0400
commit7440bd8ba5a6e542cc59754a15871c5a42cdeae9 (patch)
tree29a2c06095b18f3bf06b8e8f9a435c15c31dd49a
parentda16dd1e74ddb8ff44d15f720c52be582b77fff4 (diff)
downloadbash-7440bd8ba5a6e542cc59754a15871c5a42cdeae9.tar.gz
Bash-5.2 patch 28: fix terminal pgrp handling in DEBUG trap
-rw-r--r--patchlevel.h2
-rw-r--r--trap.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/patchlevel.h b/patchlevel.h
index b534802b..7abb1edb 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 27
+#define PATCHLEVEL 28
#endif /* _PATCHLEVEL_H_ */
diff --git a/trap.c b/trap.c
index e56f6cc3..465c3360 100644
--- a/trap.c
+++ b/trap.c
@@ -1216,7 +1216,9 @@ run_debug_trap ()
close_pgrp_pipe ();
restore_pgrp_pipe (save_pipe);
# endif
- if (pipeline_pgrp > 0 && ((subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0))
+ /* If the trap command gave the terminal to another process group,
+ restore it. XXX - check running_in_background? */
+ if (job_control && pipeline_pgrp > 0 && ((subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0))
give_terminal_to (pipeline_pgrp, 1);
notify_and_cleanup ();