about summary refs log tree commit diff
path: root/nscd/nscd_helper.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2015-10-17 12:02:37 +0200
committerFlorian Weimer <fweimer@redhat.com>2015-10-17 12:02:37 +0200
commit52fb79d6cdecb89a6f0375091e7c12ed79ae6760 (patch)
treee4885bfee90d7fe9f584518d3bc242050c725ef0 /nscd/nscd_helper.c
parentf546f87c4ffb1642ffc96b8d614c329ed35252c3 (diff)
downloadglibc-52fb79d6cdecb89a6f0375091e7c12ed79ae6760.tar.gz
glibc-52fb79d6cdecb89a6f0375091e7c12ed79ae6760.tar.xz
glibc-52fb79d6cdecb89a6f0375091e7c12ed79ae6760.zip
Assume that SOCK_CLOEXEC is available and works
This fixes (harmless) data races when accessing the various
__have_sock_cloexec variables.
Diffstat (limited to 'nscd/nscd_helper.c')
-rw-r--r--nscd/nscd_helper.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 52a5caadfa..341b9311b2 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -166,24 +166,7 @@ open_socket (request_type type, const char *key, size_t keylen)
 {
   int sock;
 
-#ifdef SOCK_CLOEXEC
-# ifndef __ASSUME_SOCK_CLOEXEC
-  if (__have_sock_cloexec >= 0)
-# endif
-    {
-      sock = __socket (PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
-# ifndef __ASSUME_SOCK_CLOEXEC
-      if (__have_sock_cloexec == 0)
-	__have_sock_cloexec = sock != -1 || errno != EINVAL ? 1 : -1;
-# endif
-    }
-#endif
-#ifndef __ASSUME_SOCK_CLOEXEC
-# ifdef SOCK_CLOEXEC
-  if (__have_sock_cloexec < 0)
-# endif
-    sock = __socket (PF_UNIX, SOCK_STREAM, 0);
-#endif
+  sock = __socket (PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
   if (sock < 0)
     return -1;
 
@@ -194,14 +177,6 @@ open_socket (request_type type, const char *key, size_t keylen)
     char key[];
   } *reqdata = alloca (real_sizeof_reqdata);
 
-#ifndef __ASSUME_SOCK_CLOEXEC
-# ifdef SOCK_NONBLOCK
-  if (__have_sock_cloexec < 0)
-# endif
-    /* Make socket non-blocking.  */
-    __fcntl (sock, F_SETFL, O_RDWR | O_NONBLOCK);
-#endif
-
   struct sockaddr_un sun;
   sun.sun_family = AF_UNIX;
   strcpy (sun.sun_path, _PATH_NSCDSOCKET);