1.1 --- a/patches/glibc/2_9/320-2.9-assume-pipe2.patch Sat Apr 11 19:03:02 2009 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,59 +0,0 @@
1.4 -Original patch from: gentoo/src/patchsets/glibc/2.9/1095_all_glibc-2.9-assume-pipe2.patch
1.5 -
1.6 --= BEGIN original header =-
1.7 -http://bugs.gentoo.org/250342
1.8 -http://sources.redhat.com/bugzilla/show_bug.cgi?id=9685
1.9 -
1.10 -we cant assume sock_cloexec and pipe2 are bound together as the former defines
1.11 -are found in glibc only while the latter are a combo of kernel headers and
1.12 -glibc. so if we do a runtime detection of SOCK_CLOEXEC, but pipe2() is a stub
1.13 -inside of glibc, we hit a problem. for example:
1.14 -
1.15 -#include <grp.h>
1.16 -#include <stdio.h>
1.17 -main()
1.18 -{
1.19 - getgrnam("portage");
1.20 - if (!popen("ls", "r"))
1.21 - perror("popen()");
1.22 -}
1.23 -
1.24 -getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set both
1.25 -__have_sock_cloexec and __have_pipe2 to true. but if glibc was built against
1.26 -older kernel headers where __NR_pipe2 does not exist, glibc will have a ENOSYS
1.27 -stub for it. so popen() will always fail as glibc assumes pipe2() works.
1.28 -
1.29 --= END original header =-
1.30 -
1.31 -diff -durN glibc-2_9.orig/include/unistd.h glibc-2_9/include/unistd.h
1.32 ---- glibc-2_9.orig/include/unistd.h 2008-07-27 20:23:17.000000000 +0200
1.33 -+++ glibc-2_9/include/unistd.h 2009-02-02 22:01:05.000000000 +0100
1.34 -@@ -167,9 +167,6 @@
1.35 - extern int __pause_nocancel (void) attribute_hidden;
1.36 -
1.37 - extern int __have_sock_cloexec;
1.38 --/* At lot of other functionality became available at the same time as
1.39 -- SOCK_CLOEXEC. Avoid defining separate variables for all of them
1.40 -- unless it is really necessary. */
1.41 --#define __have_pipe2 __have_sock_cloexec
1.42 -+extern int __have_pipe2;
1.43 -
1.44 - #endif
1.45 -diff -durN glibc-2_9.orig/socket/have_sock_cloexec.c glibc-2_9/socket/have_sock_cloexec.c
1.46 ---- glibc-2_9.orig/socket/have_sock_cloexec.c 2008-07-25 18:46:23.000000000 +0200
1.47 -+++ glibc-2_9/socket/have_sock_cloexec.c 2009-02-02 22:01:05.000000000 +0100
1.48 -@@ -16,9 +16,14 @@
1.49 - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1.50 - 02111-1307 USA. */
1.51 -
1.52 -+#include <fcntl.h>
1.53 - #include <sys/socket.h>
1.54 - #include <kernel-features.h>
1.55 -
1.56 - #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
1.57 - int __have_sock_cloexec;
1.58 - #endif
1.59 -+
1.60 -+#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
1.61 -+int __have_pipe2;
1.62 -+#endif