summaryrefslogtreecommitdiffstats
path: root/source/ap/ksh93/patches/ksh-20140415-hokaido.patch
blob: 5ff69279f125c5034f597c1f618af790579308d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff -up ksh-20120801/src/cmd/ksh93/sh/xec.c.hokaido ksh-20120801/src/cmd/ksh93/sh/xec.c
--- ksh-20120801/src/cmd/ksh93/sh/xec.c.hokaido	2014-09-18 14:41:57.696756230 +0200
+++ ksh-20120801/src/cmd/ksh93/sh/xec.c	2014-09-18 14:43:55.439205247 +0200
@@ -1633,12 +1633,20 @@ int sh_exec(register const Shnode_t *t,
 #endif /* SHOPT_COSHELL */
 			if(shp->subshell)
 			{
+				int comsubsave = shp->comsub;
+				if(comsubsave==1)
+					shp->comsub = 2;
 				sh_subtmpfile(shp);
+				shp->comsub = comsubsave;
+				if(shp->comsub==1 && (!(shp->fdstatus[1]&IONOSEEK)))
+					unpipe = iousepipe(shp);
+
 				if((type&(FAMP|TFORK))==(FAMP|TFORK))
 				{
 					if(shp->comsub && !(shp->fdstatus[1]&IONOSEEK))
 					{
-						unpipe = iousepipe(shp);
+						if (!unpipe)
+							unpipe = iousepipe(shp);
 						sh_subfork();
 					}
 				}
@@ -2107,7 +2115,11 @@ int sh_exec(register const Shnode_t *t,
 			job.curjobid = 0;
 			if(shp->subshell)
 			{
+				int comsubsave = shp->comsub;
+				if(comsubsave==1)
+					shp->comsub = 2;
 				sh_subtmpfile(shp);
+				shp->comsub = comsubsave;
 				if(shp->comsub==1 && !(shp->fdstatus[1]&IONOSEEK))
 					iousepipe(shp);
 			}