diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-29 21:18:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-29 21:18:43 +0000 |
commit | abb657cf56d799755f973114d2fac291daffc8fe (patch) | |
tree | ad17940b14c1fd8b70c0b1dafdee7fdb36666e77 /src | |
parent | b63c09cb52a52390687f1ba6d63e3ec8c745cad1 (diff) | |
download | utmps-abb657cf56d799755f973114d2fac291daffc8fe.tar.gz utmps-abb657cf56d799755f973114d2fac291daffc8fe.tar.xz utmps-abb657cf56d799755f973114d2fac291daffc8fe.zip |
Adapt to skalibs-2.10.0.0
Diffstat (limited to 'src')
-rw-r--r-- | src/utmps/utmps-utmpd.c | 6 | ||||
-rw-r--r-- | src/utmps/utmps-wtmpd.c | 6 |
2 files changed, 9 insertions, 3 deletions
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 <errno.h> #include <skalibs/posixishard.h> +#include <skalibs/posixplz.h> #include <skalibs/types.h> #include <skalibs/env.h> #include <skalibs/allreadwrite.h> @@ -15,6 +16,7 @@ #include <skalibs/tai.h> #include <skalibs/djbunix.h> #include <skalibs/unix-timed.h> + #include <utmps/utmpx.h> #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 <skalibs/tai.h> #include <skalibs/djbunix.h> #include <skalibs/unix-timed.h> + #include <utmps/utmpx.h> #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 ; } |