From b8f1f91cc6d7b579fdb2370ab046565f9930aa09 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 7 Oct 2009 22:51:55 -0400 Subject: clean up O_CLOEXEC handling Drop the "#ifndef O_CLOEXEC" cruft, enable O_CLOEXEC in most fcntl.h headers, and import __ASSUME_O_CLOEXEC from glibc. Signed-off-by: Mike Frysinger --- libc/pwd_grp/lckpwdf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libc/pwd_grp') diff --git a/libc/pwd_grp/lckpwdf.c b/libc/pwd_grp/lckpwdf.c index d9776ed2c..e02cab6ad 100644 --- a/libc/pwd_grp/lckpwdf.c +++ b/libc/pwd_grp/lckpwdf.c @@ -59,16 +59,14 @@ lckpwdf (void) /* Prevent problems caused by multiple threads. */ __UCLIBC_MUTEX_LOCK(mylock); -#ifndef O_CLOEXEC -# define O_CLOEXEC 0 -#endif lock_fd = open (_PATH_PASSWD, O_WRONLY | O_CLOEXEC); if (lock_fd == -1) { goto DONE; } +#ifndef __ASSUME_O_CLOEXEC /* Make sure file gets correctly closed when process finished. */ - if (O_CLOEXEC == 0) - fcntl (lock_fd, F_SETFD, FD_CLOEXEC); + fcntl (lock_fd, F_SETFD, FD_CLOEXEC); +#endif /* Now we have to get exclusive write access. Since multiple process could try this we won't stop when it first fails. -- cgit v1.2.3