diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-10-07 22:51:55 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-10-07 22:53:39 -0400 |
commit | b8f1f91cc6d7b579fdb2370ab046565f9930aa09 (patch) | |
tree | f4bed1003ca36419f344d5540fa1cd32da220518 /libc/pwd_grp/lckpwdf.c | |
parent | 49b5ce384740ebabfc8e38dff6e37913e224dd29 (diff) |
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 <vapier@gentoo.org>
Diffstat (limited to 'libc/pwd_grp/lckpwdf.c')
-rw-r--r-- | libc/pwd_grp/lckpwdf.c | 8 |
1 files changed, 3 insertions, 5 deletions
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. |