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