summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--include/unistd.h7
-rw-r--r--socket/have_sock_cloexec.c11
3 files changed, 21 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 79b571710a..206206a8b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-08-18  Mike Frysinger  <vapier@gentoo.org>
+
+	[BZ #9685]
+	* include/unistd.h (__have_pipe2): Change define into an extern int.
+	(__have_dup3): Likewise.
+	* socket/have_sock_cloexec.c: Include fcntl.h.
+	(__have_pipe2): New variable.
+	(__have_dup3): Likewise.
+
 2012-08-17  Mike Frysinger  <vapier@gentoo.org>
 
 	* sysdeps/unix/sysv/linux/nice.c: Adjust #include.
diff --git a/include/unistd.h b/include/unistd.h
index e4bff80fc7..9d74fb49e8 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -174,11 +174,8 @@ extern int __libc_pause (void);
 extern int __pause_nocancel (void) attribute_hidden;
 
 extern int __have_sock_cloexec;
-/* At lot of other functionality became available at the same time as
-   SOCK_CLOEXEC.  Avoid defining separate variables for all of them
-   unless it is really necessary.  */
-#define __have_pipe2 __have_sock_cloexec
-#define __have_dup3 __have_sock_cloexec
+extern int __have_pipe2;
+extern int __have_dup3;
 
 extern int __getlogin_r_loginuid (char *name, size_t namesize)
      attribute_hidden;
diff --git a/socket/have_sock_cloexec.c b/socket/have_sock_cloexec.c
index d57cbcfaad..8cf0959462 100644
--- a/socket/have_sock_cloexec.c
+++ b/socket/have_sock_cloexec.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,9 +15,18 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <fcntl.h>
 #include <sys/socket.h>
 #include <kernel-features.h>
 
 #if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
 int __have_sock_cloexec;
 #endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
+int __have_pipe2;
+#endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_DUP3
+int __have_dup3;
+#endif