aboutsummaryrefslogtreecommitdiffstats
path: root/main/expect/07-file-handle.patch
blob: 98e42180bfaea40b408b77c66661ae74a9634729 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Author: Russell Coker <russell@coker.com.au>
Description:
 Fixes file handle 3 to be left open when running programs (Closes: #166677).

--- a/exp_clib.c
+++ b/exp_clib.c
@@ -2040,6 +2040,7 @@
 
 	/* save error fd while we're setting up new one */
 	errorfd = fcntl(2,F_DUPFD,3);
+	fcntl(3, F_SETFD, FD_CLOEXEC);
 	/* and here is the macro to restore it */
 #define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);}
 
--- a/exp_command.c
+++ b/exp_command.c
@@ -1162,6 +1162,7 @@
 
     /* save error fd while we're setting up new one */
     errorfd = fcntl(2,F_DUPFD,3);
+    fcntl(3, F_SETFD, FD_CLOEXEC);
     /* and here is the macro to restore it */
 #define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);}