summaryrefslogtreecommitdiff
path: root/source/ap/ksh93/patches/ksh-20120801-retfix.patch
blob: bcb5b3326abe3c6126f80cfc15acd0abaf5e8e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff -up ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix ksh-20120801/src/cmd/ksh93/sh/subshell.c
--- ksh-20120801/src/cmd/ksh93/sh/subshell.c.retfix	2014-09-01 13:50:02.956085721 +0200
+++ ksh-20120801/src/cmd/ksh93/sh/subshell.c	2014-09-01 13:54:01.104818416 +0200
@@ -652,6 +652,16 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_
 		}
 		else
 		{
+			if(comsub!=1 && shp->spid)
+			{
+				int c = shp->exitval;
+				job_wait(shp->spid);
+				shp->exitval = c;
+				exitset();
+				if(shp->pipepid==shp->spid)
+					shp->spid = 0;
+				shp->pipepid = 0;
+			}
 			job.hack1_waitall=0;
 			/* move tmp file to iop and restore sfstdout */
 			iop = sfswap(sfstdout,NIL(Sfio_t*));