SHA256
3
0
forked from pool/expect

- bsc#1183904, expect-errorfd.patch:

errorfd file descriptors should be closed when forking

OBS-URL: https://build.opensuse.org/package/show/devel:languages:tcl/expect?expand=0&rev=29
This commit is contained in:
Reinhard Max 2021-05-10 14:07:34 +00:00 committed by Git OBS Bridge
parent be63b9b0c9
commit df041a0656
3 changed files with 52 additions and 0 deletions

44
expect-errorfd.patch Normal file
View File

@ -0,0 +1,44 @@
Index: exp_clib.c
==================================================================
--- exp_clib.c
+++ exp_clib.c
@@ -2043,11 +2043,16 @@
#endif /* SYSV3 */
#endif /* DO_SETSID */
/* save error fd while we're setting up new one */
+#ifdef F_DUPFD_CLOEXEC
+ errorfd = fcntl(2,F_DUPFD_CLOEXEC,3);
+#else
errorfd = fcntl(2,F_DUPFD,3);
+ fcntl(errorfd, F_SETFD, FD_CLOEXEC);
+#endif /* F_DUPFD_CLOXEC */
/* and here is the macro to restore it */
#define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);}
if (exp_autoallocpty) {
Index: exp_command.c
==================================================================
--- exp_command.c
+++ exp_command.c
@@ -1159,11 +1159,16 @@
/* save stderr elsewhere to avoid BSD4.4 bogosity that warns */
/* if stty finds dev(stderr) != dev(stdout) */
/* save error fd while we're setting up new one */
+#ifdef F_DUPFD_CLOEXEC
+ errorfd = fcntl(2,F_DUPFD_CLOEXEC,3);
+#else
errorfd = fcntl(2,F_DUPFD,3);
+ fcntl(errorfd, F_SETFD, FD_CLOEXEC);
+#endif /* F_DUPFD_CLOXEC */
/* and here is the macro to restore it */
#define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);}
close(0);
close(1);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon May 10 13:44:24 UTC 2021 - Reinhard Max <max@suse.com>
- bsc#1183904, expect-errorfd.patch:
errorfd file descriptors should be closed when forking
-------------------------------------------------------------------
Tue May 4 11:02:42 UTC 2021 - Matthias Gerstner <matthias.gerstner@suse.com>

View File

@ -29,6 +29,7 @@ Patch1: expect.patch
Patch2: expect-fixes.patch
Patch3: expect-log.patch
Patch4: config-guess-sub-update.patch
Patch5: expect-errorfd.patch
BuildRequires: autoconf
BuildRequires: tcl-devel
@ -57,6 +58,7 @@ expect package loaded.
%patch2
%patch3
%patch4
%patch5
%build
export CFLAGS="%{optflags} -fPIC -pie"