From abb657cf56d799755f973114d2fac291daffc8fe Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 29 Nov 2020 21:18:43 +0000 Subject: Adapt to skalibs-2.10.0.0 --- src/utmps/utmps-utmpd.c | 6 ++++-- src/utmps/utmps-wtmpd.c | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/utmps/utmps-utmpd.c b/src/utmps/utmps-utmpd.c index 9709af5..17f4cab 100644 --- a/src/utmps/utmps-utmpd.c +++ b/src/utmps/utmps-utmpd.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include + #include #include "utmps-internal.h" @@ -75,7 +77,7 @@ static int read_utmp_entry_unlocked (char *s) static void lockit (int w) { - if ((w ? lock_ex(fd) : lock_sh(fd)) < 0) + if (fd_lock(fd, w, 0) < 1) { unlink_void("utmp") ; answer(errno) ; @@ -85,7 +87,7 @@ static void lockit (int w) static inline void unlockit (void) { - lock_unx(fd) ; + fd_unlock(fd) ; } static int idmatch (unsigned short type, char const *id, struct utmpx const *b) diff --git a/src/utmps/utmps-wtmpd.c b/src/utmps/utmps-wtmpd.c index 989e761..6a543af 100644 --- a/src/utmps/utmps-wtmpd.c +++ b/src/utmps/utmps-wtmpd.c @@ -15,6 +15,7 @@ #include #include #include + #include #include "utmps-internal.h" @@ -80,7 +81,7 @@ int main (void) answer(errno) ; strerr_diefu1sys(111, "open wtmp") ; } - if (lock_ex(fd) < 0) + if (fd_lock(fd, 1, 0) < 1) { answer(errno) ; strerr_diefu1sys(111, "open wtmp") ; @@ -99,10 +100,13 @@ int main (void) struct stat st ; if (!fstat(fd, &st)) ftruncate(fd, st.st_size - w) ; } + fd_unlock(fd) ; answer(e) ; + errno = e ; strerr_diefu1sys(111, "append to wtmp") ; } fsync(fd) ; + fd_unlock(fd) ; answer(0) ; return 0 ; } -- cgit 1.4.1