about summary refs log tree commit diff
path: root/sysdeps/posix/shm_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/shm_open.c')
-rw-r--r--sysdeps/posix/shm_open.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/sysdeps/posix/shm_open.c b/sysdeps/posix/shm_open.c
index 56a9965263..64315de8f8 100644
--- a/sysdeps/posix/shm_open.c
+++ b/sysdeps/posix/shm_open.c
@@ -34,10 +34,7 @@ shm_open (const char *name, int oflag, mode_t mode)
 {
   SHM_GET_NAME (EINVAL, -1, "");
 
-  oflag |= O_NOFOLLOW;
-# ifdef O_CLOEXEC
-  oflag |= O_CLOEXEC;
-# endif
+  oflag |= O_NOFOLLOW | O_CLOEXEC;
 
   /* Disable asynchronous cancellation.  */
   int state;
@@ -50,29 +47,6 @@ shm_open (const char *name, int oflag, mode_t mode)
        object names and the standard does not mention EISDIR.  */
     __set_errno (EINVAL);
 
-# ifndef O_CLOEXEC
-  if (fd != -1)
-    {
-      /* We got a descriptor.  Now set the FD_CLOEXEC bit.  */
-      int flags = fcntl (fd, F_GETFD, 0);
-
-      if (__glibc_likely (flags != -1))
-	{
-	  flags |= FD_CLOEXEC;
-	  flags = fcntl (fd, F_SETFD, flags);
-	}
-
-      if (flags == -1)
-	{
-	  /* Something went wrong.  We cannot return the descriptor.  */
-	  int save_errno = errno;
-	  close (fd);
-	  fd = -1;
-	  __set_errno (save_errno);
-	}
-    }
-# endif
-
   pthread_setcancelstate (state, NULL);
 
   return fd;