Fix leaked fd

This commit is contained in:
Vitezslav Crhonek 2014-09-09 13:28:10 +02:00
parent 5da52d0d35
commit 10986c4d79
2 changed files with 20 additions and 1 deletions

12
expect-5.45-fd-leak.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up expect5.45/exp_clib.c.orig expect5.45/exp_clib.c
--- expect5.45/exp_command.c.orig 2014-09-04 12:12:21.075837835 +0200
+++ expect5.45/exp_command.c 2014-09-04 12:13:39.098593465 +0200
@@ -1161,7 +1161,7 @@ Exp_SpawnObjCmd(
/* if stty finds dev(stderr) != dev(stdout) */
/* save error fd while we're setting up new one */
- errorfd = fcntl(2,F_DUPFD,3);
+ errorfd = fcntl(2,F_DUPFD_CLOEXEC,3);
/* and here is the macro to restore it */
#define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);}

View File

@ -5,7 +5,7 @@
Summary: A program-script interaction and testing utility
Name: expect
Version: %{majorver}
Release: 17%{?dist}
Release: 18%{?dist}
License: Public Domain
Group: Development/Languages
# URL: probably more useful is http://sourceforge.net/projects/expect/
@ -28,6 +28,8 @@ Patch5: expect-5.45-exp-log-buf-overflow.patch
# Patch6: fixes segfaults if Tcl is built with stubs and Expect is used directly
# from C program rhbz#1091060
Patch6: expect-5.45-segfault-with-stubs.patch
# Patch7: fixes leaked fd, patch by Matej Mužila, rhbz#1001220
Patch7: expect-5.45-fd-leak.patch
# examples patches
# Patch100: changes random function
Patch100: expect-5.32.2-random.patch
@ -88,6 +90,7 @@ of expectk.
%patch4 -p1 -b .re-memleak
%patch5 -p1 -b .exp-log-buf-overflow
%patch6 -p1 -b .segfault-with-stubs
%patch7 -p1 -b .fd-leak
# examples fixes
%patch100 -p1 -b .random
%patch101 -p1 -b .mkpasswd-dash
@ -177,6 +180,10 @@ rm -rf "$RPM_BUILD_ROOT"
%{_mandir}/man1/tknewsbiff.1*
%changelog
* Tue Sep 09 2014 Vitezslav Crhonek <vcrhonek@redhat.com> - 5.45-18
- Fix leaked fd (patch by Matej Mužila)
Resolves: #1001220
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.45-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild