aboutsummaryrefslogtreecommitdiffstats
path: root/main/expect/12-fdout.patch
blob: 0942819ad1f93ec74cdcf02f4d34a8de94db04d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Author: Ian Jackson <iwj@ubuntu.com>
Description: expBusy forgets to open fdout (Closes: #440818).

--- a/exp_command.c
+++ b/exp_command.c
@@ -315,7 +315,15 @@
 	fcntl(x,F_DUPFD,esPtr->fdin);
 	close(x);
     }
-    expCloseOnExec(esPtr->fdin);
+    if (esPtr->fdout != EXP_NOFD &&
+	esPtr->fdout != esPtr->fdin) {
+	fcntl(esPtr->fdin,F_DUPFD,esPtr->fdout);
+    }
+    if (esPtr->fdin > 2)
+	expCloseOnExec(esPtr->fdin);
+    if (esPtr->fdout != EXP_NOFD &&
+	esPtr->fdout > 2)
+	expCloseOnExec(esPtr->fdout);
     esPtr->fdBusy = TRUE;
 }