Blob Blame Raw
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix ksh-20120801/src/cmd/ksh93/sh/subshell.c
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix	2014-09-01 13:50:02.956085721 +0200
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c	2014-09-01 13:54:01.104818416 +0200
@@ -652,6 +652,16 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
 		}
 		else
 		{
+			if(comsub!=1 && shp->spid)
+			{
+				int c = shp->exitval;
+				job_wait(shp->spid);
+				shp->exitval = c;
+				exitset();
+				if(shp->pipepid==shp->spid)
+					shp->spid = 0;
+				shp->pipepid = 0;
+			}
 			job.hack1_waitall=0;
 			/* move tmp file to iop and restore sfstdout */
 			iop = sfswap(sfstdout,NIL(Sfio_t*));