about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-07-26 22:35:15 +0000
committerUlrich Drepper <drepper@redhat.com>2008-07-26 22:35:15 +0000
commit7438a80dcbb3c6766fe0288935c545c6a0f98257 (patch)
tree1fe7432a171cd92257f8042e72ecd918bf9c8824 /login
parent7b91359b2cb44b56478e7a5ef9070737fa266656 (diff)
downloadglibc-7438a80dcbb3c6766fe0288935c545c6a0f98257.tar.gz
glibc-7438a80dcbb3c6766fe0288935c545c6a0f98257.tar.xz
glibc-7438a80dcbb3c6766fe0288935c545c6a0f98257.zip
* login/utmp_file.c (setutent_file): Minor optimization in case
	O_CLOEXEC is available.
Diffstat (limited to 'login')
-rw-r--r--login/utmp_file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/login/utmp_file.c b/login/utmp_file.c
index a1c6a25716..c0bd229952 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>
    and Paul Janzen <pcj@primenet.com>, 1996.
@@ -167,10 +167,11 @@ setutent_file (void)
 # ifdef O_CLOEXEC
 	      if (__have_o_cloexec == 0)
 		__have_o_cloexec = (result & FD_CLOEXEC) ? 1 : -1;
-# endif
 
-	      result = fcntl_not_cancel (file_fd, F_SETFD,
-					 result | FD_CLOEXEC);
+	      if (__have_o_cloexec < 0)
+# endif
+		result = fcntl_not_cancel (file_fd, F_SETFD,
+					   result | FD_CLOEXEC);
 	    }
 
 	  if (result == -1)