about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-08-03 04:09:03 +0000
committerUlrich Drepper <drepper@redhat.com>2007-08-03 04:09:03 +0000
commitcbf0489bcf3eebeeba595a514461057a4e2f1e8b (patch)
tree5494b98023b95a29643094578424382515a41724 /login
parentfa39685d5c7df2502213418bead44e9543a9b9ec (diff)
downloadglibc-cbf0489bcf3eebeeba595a514461057a4e2f1e8b.tar.gz
glibc-cbf0489bcf3eebeeba595a514461057a4e2f1e8b.tar.xz
glibc-cbf0489bcf3eebeeba595a514461057a4e2f1e8b.zip
* io/Makefile (aux): Add have_o_cloexec.
	* include/fcntl.h: Declare __have_o_cloexec.
	* io/have_o_cloexec.c: New file.
	* sysdeps/unix/opendir.c (__opendir): Use O_CLOEXEC is available.
	(__alloc_dir): If O_CLOEXEC has been used, don't duplicate the
	fcntl call if not necessary.
	* login/utmp_file.c (setutent_file): Use __have_o_cloexec instead
	of local variable.
Diffstat (limited to 'login')
-rw-r--r--login/utmp_file.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/login/utmp_file.c b/login/utmp_file.c
index 4a9e409454..a1c6a25716 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -157,9 +157,7 @@ setutent_file (void)
 
 #ifndef __ASSUME_O_CLOEXEC
 # ifdef O_CLOEXEC
-      static int have_o_cloexec;
-
-      if (have_o_cloexec <= 0)
+      if (__have_o_cloexec <= 0)
 # endif
 	{
 	  /* We have to make sure the file is `closed on exec'.  */
@@ -167,8 +165,8 @@ setutent_file (void)
 	  if (result >= 0)
 	    {
 # ifdef O_CLOEXEC
-	      if (have_o_cloexec == 0)
-		have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
+	      if (__have_o_cloexec == 0)
+		__have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
 # endif
 
 	      result = fcntl_not_cancel (file_fd, F_SETFD,