Blame SOURCES/ksh-20140415-hokaido.patch

ff22b9
diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.hokaido ksh-20120801/src/cmd/ksh93/sh/xec.c
ff22b9
--- ksh-20120801/src/cmd/ksh93/sh/xec.c.hokaido	2014-09-18 14:41:57.696756230 +0200
ff22b9
+++ ksh-20120801/src/cmd/ksh93/sh/xec.c	2014-09-18 14:43:55.439205247 +0200
ff22b9
@@ -1633,12 +1633,20 @@ int sh_exec(register const Shnode_t *t,
ff22b9
 #endif /* SHOPT_COSHELL */
ff22b9
 			if(shp->subshell)
ff22b9
 			{
ff22b9
+				int comsubsave = shp->comsub;
ff22b9
+				if(comsubsave==1)
ff22b9
+					shp->comsub = 2;
ff22b9
 				sh_subtmpfile(shp);
ff22b9
+				shp->comsub = comsubsave;
ff22b9
+				if(shp->comsub==1 && (!(shp->fdstatus[1]&IONOSEEK)))
ff22b9
+					unpipe = iousepipe(shp);
ff22b9
+
ff22b9
 				if((type&(FAMP|TFORK))==(FAMP|TFORK))
ff22b9
 				{
ff22b9
 					if(shp->comsub && !(shp->fdstatus[1]&IONOSEEK))
ff22b9
 					{
ff22b9
-						unpipe = iousepipe(shp);
ff22b9
+						if (!unpipe)
ff22b9
+							unpipe = iousepipe(shp);
ff22b9
 						sh_subfork();
ff22b9
 					}
ff22b9
 				}
ff22b9
@@ -2107,7 +2115,11 @@ int sh_exec(register const Shnode_t *t,
ff22b9
 			job.curjobid = 0;
ff22b9
 			if(shp->subshell)
ff22b9
 			{
ff22b9
+				int comsubsave = shp->comsub;
ff22b9
+				if(comsubsave==1)
ff22b9
+					shp->comsub = 2;
ff22b9
 				sh_subtmpfile(shp);
ff22b9
+				shp->comsub = comsubsave;
ff22b9
 				if(shp->comsub==1 && !(shp->fdstatus[1]&IONOSEEK))
ff22b9
 					iousepipe(shp);
ff22b9
 			}