diff options
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. |