642af4d
diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.mtty ksh-20120801/src/cmd/ksh93/sh/xec.c
642af4d
--- ksh-20120801/src/cmd/ksh93/sh/xec.c.mtty	2014-01-22 16:52:06.441608750 +0100
642af4d
+++ ksh-20120801/src/cmd/ksh93/sh/xec.c	2014-01-22 16:52:06.485608361 +0100
642af4d
@@ -3163,7 +3169,7 @@ pid_t _sh_fork(Shell_t *shp,register pid
642af4d
 			 * completed.  Make parent the job group id.
642af4d
 			 */
642af4d
 			if(postid==0)
642af4d
-				job.curpgid = parent;
642af4d
+				job.curpgid = job.jobcontrol?parent:getpid();
642af4d
 			if(job.jobcontrol || (flags&FAMP))
642af4d
 			{
642af4d
 				if(setpgid(parent,job.curpgid)<0 && errno==EPERM)