Blame SPECS/ksh-20140415-hokaido.patch

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