Bash-5.0 patch 7: fix exec builtin leaving the terminal in the wrong process group

This commit is contained in:
Chet Ramey 2019-04-20 14:27:56 -04:00
parent dfd2cc6ac5
commit 3ba697465b
2 changed files with 6 additions and 8 deletions

12
jobs.c
View File

@ -4837,15 +4837,13 @@ void
end_job_control () end_job_control ()
{ {
if (job_control) if (job_control)
{ terminate_stopped_jobs ();
terminate_stopped_jobs ();
if (original_pgrp >= 0) if (original_pgrp >= 0 && terminal_pgrp != original_pgrp)
give_terminal_to (original_pgrp, 1); give_terminal_to (original_pgrp, 1);
}
if (original_pgrp >= 0) if (original_pgrp >= 0 && setpgid (0, original_pgrp) == 0)
setpgid (0, original_pgrp); shell_pgrp = original_pgrp;
} }
/* Restart job control by closing shell tty and reinitializing. This is /* Restart job control by closing shell tty and reinitializing. This is

View File

@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */ looks for to find the patch level (for the sccs version string). */
#define PATCHLEVEL 6 #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */ #endif /* _PATCHLEVEL_H_ */