diff options
Diffstat (limited to 'libc/misc/utmp/utent.c')
-rw-r--r-- | libc/misc/utmp/utent.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index c83f45e73..a678130a3 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -19,6 +19,7 @@ #include <errno.h> #include <string.h> #include <utmp.h> +#include <not-cancel.h> #include <bits/uClibc_mutex.h> __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER); @@ -46,16 +47,16 @@ static const char *static_ut_name = default_file_name; static_if_threaded void __setutent(void) { if (static_fd < 0) { - static_fd = open(static_ut_name, O_RDWR | O_CLOEXEC); + static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC); if (static_fd < 0) { - static_fd = open(static_ut_name, O_RDONLY | O_CLOEXEC); + static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC); if (static_fd < 0) { return; /* static_fd remains < 0 */ } } #ifndef __ASSUME_O_CLOEXEC /* Make sure the file will be closed on exec() */ - fcntl(static_fd, F_SETFD, FD_CLOEXEC); + fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC); #endif return; } @@ -81,7 +82,7 @@ static_if_threaded struct utmp *__getutent(void) } } - if (read(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) { + if (read_not_cancel(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) { return &static_utmp; } @@ -103,7 +104,7 @@ void endutent(void) { __UCLIBC_MUTEX_LOCK(utmplock); if (static_fd >= 0) - close(static_fd); + close_not_cancel_no_status(static_fd); static_fd = -1; __UCLIBC_MUTEX_UNLOCK(utmplock); } @@ -193,7 +194,7 @@ int utmpname(const char *new_ut_name) } if (static_fd >= 0) { - close(static_fd); + close_not_cancel_no_status(static_fd); static_fd = -1; } __UCLIBC_MUTEX_UNLOCK(utmplock); |