Blame SOURCES/ksh-20120801-kshmfix.patch

503c26
diff -up ksh-20120801/src/cmd/ksh93/sh/main.c.monintoron ksh-20120801/src/cmd/ksh93/sh/main.c
503c26
--- ksh-20120801/src/cmd/ksh93/sh/main.c.monintoron	2013-05-31 10:15:02.738828102 +0200
503c26
+++ ksh-20120801/src/cmd/ksh93/sh/main.c	2013-05-31 10:15:36.057095262 +0200
503c26
@@ -406,10 +406,10 @@ static void	exfile(register Shell_t *shp
503c26
 		{
503c26
 			buff.mode = SH_JMPEXIT;
503c26
 			sh_onoption(SH_TRACKALL);
503c26
-			sh_offoption(SH_MONITOR);
503c26
 		}
503c26
 		sh_offstate(SH_INTERACTIVE);
503c26
-		sh_offstate(SH_MONITOR);
503c26
+		if(sh_isoption(SH_MONITOR))
503c26
+			sh_onstate(SH_MONITOR);
503c26
 		sh_offstate(SH_HISTORY);
503c26
 		sh_offoption(SH_HISTORY);
503c26
 	}
503c26
diff -up ksh-20120801/src/cmd/ksh93/sh/jobs.c.orig ksh-20120801/src/cmd/ksh93/sh/jobs.c
503c26
--- ksh-20120801/src/cmd/ksh93/sh/jobs.c.orig	2013-05-31 10:12:28.358590452 +0200
503c26
+++ ksh-20120801/src/cmd/ksh93/sh/jobs.c	2013-05-31 10:16:51.203697890 +0200
503c26
@@ -548,7 +548,7 @@ int job_reap(register int sig)
503c26
 		{
503c26
 			px = job_byjid((int)pw->p_job);
503c26
 			for(; px && (px->p_flag&P_DONE); px=px->p_nxtproc);
503c26
-			if(!px)
503c26
+			if(!px && sh_isoption(SH_INTERACTIVE))
503c26
 				tcsetpgrp(JOBTTY,job.mypid);
503c26
 		}
503c26
 #ifndef SHOPT_BGX
503c26
@@ -842,10 +842,11 @@ static void job_set(register struct proc
503c26
 
503c26
 static void job_reset(register struct process *pw)
503c26
 {
503c26
+	Shell_t *shp = pw->p_shp;
503c26
 	/* save the terminal state for current job */
503c26
 #ifdef SIGTSTP
503c26
 	job_fgrp(pw,tcgetpgrp(job.fd));
503c26
-	if(tcsetpgrp(job.fd,job.mypid) !=0)
503c26
+	if(sh_isoption(SH_INTERACTIVE) && tcsetpgrp(job.fd,job.mypid) !=0)
503c26
 		return;
503c26
 #endif	/* SIGTSTP */
503c26
 	/* force the following tty_get() to do a tcgetattr() unless fg */
503c26
diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.orig ksh-20120801/src/cmd/ksh93/sh/xec.c
503c26
--- ksh-20120801/src/cmd/ksh93/sh/xec.c.orig	2013-05-31 10:12:27.000000000 +0200
503c26
+++ ksh-20120801/src/cmd/ksh93/sh/xec.c	2013-05-31 10:18:14.650367185 +0200
503c26
@@ -2201,7 +2201,7 @@ int sh_exec(register const Shnode_t *t,
503c26
 			}
503c26
 			shp->exitval = n;
503c26
 #ifdef SIGTSTP
503c26
-			if(!pipejob && sh_isstate(SH_MONITOR))
503c26
+			if(!pipejob && sh_isstate(SH_MONITOR) && sh_isoption(SH_INTERACTIVE))
503c26
 				tcsetpgrp(JOBTTY,shp->gd->pid);
503c26
 #endif /*SIGTSTP */
503c26
 			job.curpgid = savepgid;
f38fd1
diff -up ksh-20120801/src/cmd/ksh93/edit/edit.c.kshmfix ksh-20120801/src/cmd/ksh93/edit/edit.c
f38fd1
--- ksh-20120801/src/cmd/ksh93/edit/edit.c.kshmfix      2013-09-23 10:46:57.007256192 +0200
f38fd1
+++ ksh-20120801/src/cmd/ksh93/edit/edit.c      2013-09-23 10:47:43.988937610 +0200
f38fd1
@@ -1050,7 +1050,7 @@ int ed_getchar(register Edit_t *ep,int m
f38fd1
 		{
f38fd1
 			if(mode<=0 && -c == ep->e_intr)
f38fd1
 			{
f38fd1
-				sh_fault(SIGINT);
f38fd1
+				killpg(getpgrp(),SIGINT);
f38fd1
 				siglongjmp(ep->e_env, UINTR);
f38fd1
 			}
f38fd1
 			if(mode<=0 && ep->sh->st.trap[SH_KEYTRAP])
f38fd1