summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/opensock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/opensock.c')
-rw-r--r--sysdeps/unix/sysv/linux/opensock.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/sysdeps/unix/sysv/linux/opensock.c b/sysdeps/unix/sysv/linux/opensock.c
index bcf7f5fc40..4894bf995f 100644
--- a/sysdeps/unix/sysv/linux/opensock.c
+++ b/sysdeps/unix/sysv/linux/opensock.c
@@ -21,7 +21,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/socket.h>
-#include <kernel-features.h>
 
 /* Return a socket of any type.  The socket can be used in subsequent
    ioctl calls to talk to the kernel.  */
@@ -63,24 +62,7 @@ __opensock (void)
     {
       assert (last_type != 0);
 
-#ifdef SOCK_CLOEXEC
-# ifndef __ASSUME_SOCK_CLOEXEC
-      if (__have_sock_cloexec >= 0)
-# endif
-	{
-	  result = __socket (last_family, last_type | SOCK_CLOEXEC, 0);
-# ifndef __ASSUME_SOCK_CLOEXEC
-	  if (__have_sock_cloexec == 0)
-	    __have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
-# endif
-	}
-#endif
-#ifndef __ASSUME_SOCK_CLOEXEC
-# ifdef SOCK_CLOEXEC
-      if (__have_sock_cloexec < 0)
-# endif
-	result = __socket (last_family, last_type, 0);
-#endif
+      result = __socket (last_family, last_type | SOCK_CLOEXEC, 0);
       if (result != -1 || errno != EAFNOSUPPORT)
 	/* Maybe the socket type isn't supported anymore (module is
 	   unloaded).  In this case again try to find the type.  */
@@ -115,24 +97,7 @@ __opensock (void)
       if (afs[cnt].family == AF_NETROM || afs[cnt].family == AF_X25)
 	type = SOCK_SEQPACKET;
 
-#ifdef SOCK_CLOEXEC
-# ifndef __ASSUME_SOCK_CLOEXEC
-      if (__have_sock_cloexec >= 0)
-# endif
-	{
-	  result = __socket (afs[cnt].family, type | SOCK_CLOEXEC, 0);
-# ifndef __ASSUME_SOCK_CLOEXEC
-	  if (__have_sock_cloexec == 0)
-	    __have_sock_cloexec = result != -1 || errno != EINVAL ? 1 : -1;
-# endif
-	}
-#endif
-#ifndef __ASSUME_SOCK_CLOEXEC
-# ifdef SOCK_CLOEXEC
-      if (__have_sock_cloexec < 0)
-# endif
-	result = __socket (afs[cnt].family, type, 0);
-#endif
+      result = __socket (afs[cnt].family, type | SOCK_CLOEXEC, 0);
       if (result != -1)
 	{
 	  /* Found an available family.  */