about summary refs log tree commit diff
path: root/nis/nss_compat/compat-initgroups.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_compat/compat-initgroups.c')
-rw-r--r--nis/nss_compat/compat-initgroups.c52
1 files changed, 2 insertions, 50 deletions
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 1b37e0c295..795213448c 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -77,20 +77,6 @@ struct ent_t
 };
 typedef struct ent_t ent_t;
 
-
-/* Positive if O_CLOEXEC is supported, negative if it is not supported,
-   zero if it is still undecided.  This variable is shared with the
-   other compat functions.  */
-#ifdef __ASSUME_O_CLOEXEC
-# define __compat_have_cloexec 1
-#else
-# ifdef O_CLOEXEC
-extern int __compat_have_cloexec;
-# else
-#  define __compat_have_cloexec -1
-# endif
-#endif
-
 /* Prototypes for local functions.  */
 static void blacklist_store_name (const char *, ent_t *);
 static int in_blacklist (const char *, int, ent_t *);
@@ -141,42 +127,8 @@ internal_setgrent (ent_t *ent)
   if (ent->stream == NULL)
     status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
   else
-    {
-      /* We have to make sure the file is  `closed on exec'.  */
-      int result = 0;
-
-      if (__compat_have_cloexec <= 0)
-	{
-	  int flags;
-	  result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD, 0);
-	  if (result >= 0)
-	    {
-#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
-	      if (__compat_have_cloexec == 0)
-		__compat_have_cloexec = (flags & FD_CLOEXEC) ? 1 : -1;
-
-	      if (__compat_have_cloexec < 0)
-#endif
-		{
-		  flags |= FD_CLOEXEC;
-		  result = fcntl (fileno_unlocked (ent->stream), F_SETFD,
-				  flags);
-		}
-	    }
-	}
-
-      if (result < 0)
-	{
-	  /* Something went wrong.  Close the stream and return a
-	     failure.  */
-	  fclose (ent->stream);
-	  ent->stream = NULL;
-	  status = NSS_STATUS_UNAVAIL;
-	}
-      else
-	/* We take care of locking ourself.  */
-	__fsetlocking (ent->stream, FSETLOCKING_BYCALLER);
-    }
+    /* We take care of locking ourself.  */
+    __fsetlocking (ent->stream, FSETLOCKING_BYCALLER);
 
   return status;
 }