Blame SOURCES/ksh-20140415-hokaido.patch

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