ff22b9
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix ksh-20120801/src/cmd/ksh93/sh/subshell.c
ff22b9
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix	2014-10-01 17:34:47.720532950 +0200
ff22b9
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c	2014-10-01 17:35:25.850350378 +0200
ff22b9
@@ -655,7 +655,10 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
ff22b9
 			job.hack1_waitall=0;
ff22b9
 			if(comsub!=1 && shp->spid)
ff22b9
 			{
ff22b9
+				int c = shp->exitval;
ff22b9
 				job_wait(shp->spid);
ff22b9
+				shp->exitval = c;
ff22b9
+				exitset();
ff22b9
 				if(shp->pipepid==shp->spid)
ff22b9
 					shp->spid = 0;
ff22b9
 				shp->pipepid = 0;