Skip to content

Commit 3ba6974

Browse files
author
Chet Ramey
committed
Bash-5.0 patch 7: fix exec builtin leaving the terminal in the wrong process group
1 parent dfd2cc6 commit 3ba6974

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

jobs.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -4837,15 +4837,13 @@ void
48374837
end_job_control ()
48384838
{
48394839
if (job_control)
4840-
{
4841-
terminate_stopped_jobs ();
4840+
terminate_stopped_jobs ();
48424841

4843-
if (original_pgrp >= 0)
4844-
give_terminal_to (original_pgrp, 1);
4845-
}
4842+
if (original_pgrp >= 0 && terminal_pgrp != original_pgrp)
4843+
give_terminal_to (original_pgrp, 1);
48464844

4847-
if (original_pgrp >= 0)
4848-
setpgid (0, original_pgrp);
4845+
if (original_pgrp >= 0 && setpgid (0, original_pgrp) == 0)
4846+
shell_pgrp = original_pgrp;
48494847
}
48504848

48514849
/* Restart job control by closing shell tty and reinitializing. This is

patchlevel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
2626
looks for to find the patch level (for the sccs version string). */
2727

28-
#define PATCHLEVEL 6
28+
#define PATCHLEVEL 7
2929

3030
#endif /* _PATCHLEVEL_H_ */

0 commit comments

Comments
 (0)