From fa3a3d7955074eb15ecb726f3cfcc9b61e499e9b Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 2 Feb 2021 04:25:46 +0000 Subject: [PATCH] sh_ntfork(): handle SIGTSTP along with SIGTTIN and SIGTTOU This applies a patch from OpenSUSE that makes SIGTSTP handling consistent with that of SIGTTIN and SIGTTOU. https://build.opensuse.org/package/view_file/shells/ksh/ksh93-signals.dif --- src/cmd/ksh93/sh/xec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index d594fd59c2ba..8735a6b2c066 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -3573,6 +3573,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in { signal(SIGTTIN,SIG_DFL); signal(SIGTTOU,SIG_DFL); + signal(SIGTSTP,SIG_DFL); } #endif /* SIGTSTP */ #ifdef JOBS @@ -3610,6 +3611,10 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in { signal(SIGTTIN,SIG_IGN); signal(SIGTTOU,SIG_IGN); + if(sh_isstate(SH_INTERACTIVE)) + signal(SIGTSTP,SIG_IGN); + else + signal(SIGTSTP,SIG_DFL); } #endif /* SIGTSTP */ if(spawnpid>0) @@ -3695,6 +3700,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in { signal(SIGTTIN,SIG_DFL); signal(SIGTTOU,SIG_DFL); + signal(SIGTSTP,SIG_DFL); jobwasset++; } #endif /* SIGTSTP */ @@ -3758,6 +3764,10 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in { signal(SIGTTIN,SIG_IGN); signal(SIGTTOU,SIG_IGN); + if(sh_isstate(SH_INTERACTIVE)) + signal(SIGTSTP,SIG_IGN); + else + signal(SIGTSTP,SIG_DFL); } #endif /* SIGTSTP */ if(sigwasset)