From 4645e6ad3314789b477d1213c53e53b8320016a3 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 2 Feb 2021 12:49:00 +0000 Subject: [PATCH] job_reset(): fix for resetting foreground process group Patch from OpenSUSE: https://build.opensuse.org/package/view_file/shells/ksh/ksh93-foreground-prgrp.dif src/cmd/ksh93/sh/jobs.c: job_reset(): - Only reset the foreground process group associated with the current job if the current job's process ID is different from the terminal's foreground process group ID. --- src/cmd/ksh93/sh/jobs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/ksh93/sh/jobs.c b/src/cmd/ksh93/sh/jobs.c index acefa2972..9b5348c4b 100644 --- a/src/cmd/ksh93/sh/jobs.c +++ b/src/cmd/ksh93/sh/jobs.c @@ -738,7 +738,9 @@ static void job_reset(register struct process *pw) { /* save the terminal state for current job */ #ifdef SIGTSTP - job_fgrp(pw,tcgetpgrp(job.fd)); + pid_t tgrp; + if((tgrp=tcgetpgrp(job.fd))!=job.mypid) + job_fgrp(pw,tgrp); if(sh_isoption(SH_INTERACTIVE) && tcsetpgrp(job.fd,job.mypid) !=0) return; #endif /* SIGTSTP */