aports/main/expect/07-file-handle.patch
Alex Xu (Hello71) 85374e9406 main/expect: add some debian patches
code quality is still awful but hopefully works slightly better now?

fixes #10938
2021-08-09 08:50:34 +00:00

24 lines
725 B
Diff

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);}