--- src/cmd/ksh93/sh/main.c +++ src/cmd/ksh93/sh/main.c 2007-11-13 13:07:40.000000000 +0000 @@ -418,6 +418,7 @@ static void exfile(register Shell_t *shp sh_onoption(SH_TRACKALL); sh_offoption(SH_MONITOR); } + sh_sigdone(); sh_offstate(SH_INTERACTIVE); sh_offstate(SH_MONITOR); sh_offstate(SH_HISTORY); --- src/cmd/ksh93/sh/fault.c +++ src/cmd/ksh93/sh/fault.c 2007-11-13 13:53:15.000000000 +0000 @@ -98,12 +98,27 @@ void sh_fault(register int sig) if(flag&SH_SIGDONE) { void *ptr=0; - if((flag&SH_SIGINTERACTIVE) && sh_isstate(SH_INTERACTIVE) && !sh_isstate(SH_FORKED) && ! shp->subshell) + switch (sig) { - /* check for TERM signal between fork/exec */ - if(sig==SIGTERM && job.in_critical) - shp->trapnote |= SH_SIGTERM; - return; + case SIGINT: + if(sh_isstate(SH_FORKED) || shp->subshell) + goto out; + if(!job.in_critical) + goto out; + return; + case SIGTERM: + if(sh_isstate(SH_FORKED) || shp->subshell) + break; + /* check for TERM signal between fork/exec */ + if(job.in_critical) + shp->trapnote |= SH_SIGTERM; + if((flag&SH_SIGINTERACTIVE) && sh_isstate(SH_INTERACTIVE)) + return; + break; + case SIGQUIT: + return; + default: + break; } shp->lastsig = sig; sigrelease(sig); @@ -136,6 +151,7 @@ void sh_fault(register int sig) return; } } +out: errno = 0; if(pp->mode==SH_JMPCMD) shp->lastsig = sig; --- src/cmd/ksh93/data/signals.c +++ src/cmd/ksh93/data/signals.c 2007-11-13 13:55:49.000000000 +0000 @@ -20,6 +20,7 @@ #include #include "shtable.h" #include "fault.h" +#include "jobs.h" #if defined(SIGCLD) && !defined(SIGCHLD) # define SIGCHLD SIGCLD @@ -95,9 +96,9 @@ const struct shtable2 shtab_signals[] = "HUP", VAL(SIGHUP,SH_SIGDONE), S("Hangup"), "ILL", VAL(SIGILL,SH_SIGDONE), S("Illegal instruction"), #ifdef JOBS - "INT", VAL(SIGINT,SH_SIGINTERACTIVE), S("Interrupt"), + "INT", VAL(SIGINT,SH_SIGDONE|SH_SIGINTERACTIVE), S("Interrupt"), #else - "INT", VAL(SIGINT,SH_SIGINTERACTIVE), "", + "INT", VAL(SIGINT,SH_SIGDONE|SH_SIGINTERACTIVE), "", #endif /* JOBS */ #ifdef SIGIO "IO", VAL(SIGIO,SH_SIGIGNORE), S("IO signal"),