diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 17:00:24 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 17:00:24 +0000 |
commit | bd20906402bc1a41e60deab956218a799e4cb8aa (patch) | |
tree | 475027da7796559bf33a672f687bd6b503146050 /src | |
parent | f9bb48be0295195c97bad86fe2dbe4ce8a9ea009 (diff) | |
download | utmps-bd20906402bc1a41e60deab956218a799e4cb8aa.tar.gz utmps-bd20906402bc1a41e60deab956218a799e4cb8aa.tar.xz utmps-bd20906402bc1a41e60deab956218a799e4cb8aa.zip |
Adapt to skalibs-2.7.0.0
Diffstat (limited to 'src')
-rw-r--r-- | src/utmps/utmps-utmpd.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/utmps/utmps-utmpd.c b/src/utmps/utmps-utmpd.c index d8183ae..cde2ea0 100644 --- a/src/utmps/utmps-utmpd.c +++ b/src/utmps/utmps-utmpd.c @@ -53,9 +53,7 @@ static void maybe_open (void) umask(m) ; if (fd < 0) { - int e = errno ; - answer(e) ; - errno = e ; + answer(errno) ; strerr_diefu1sys(111, "open utmp file") ; } } @@ -64,18 +62,16 @@ static void maybe_open (void) static int read_utmp_entry (char *s) { ssize_t r ; - int e ; - if (lock_sh(fd) < 0) { e = errno ; goto err ; } + if (lock_sh(fd) < 0) goto err ; r = read(fd, s, sizeof(struct utmpx)) ; lock_unx(fd) ; - if (r < 0) { e = errno ; goto err ; } + if (r < 0) goto err ; if (!r) return 0 ; - if (r < sizeof(struct utmpx)) { e = EPIPE ; goto err ; } - return 1 ; + if (r == sizeof(struct utmpx)) return 1 ; + errno = EPIPE ; err: - unlink("utmp") ; - answer(e) ; - errno = e ; + unlink_void("utmp") ; + answer(errno) ; strerr_diefu1sys(111, "read utmp file") ; } @@ -172,9 +168,7 @@ static void do_putline (uid_t uid) if (lock_ex(fd) < 0) { answer(errno) ; return ; } if (allwrite(fd, buf, sizeof(struct utmpx)) < sizeof(struct utmpx)) { - int e = errno ; - answer(e) ; - errno = e ; + answer(errno) ; strerr_diefu1sys(111, "write to utmp") ; } fsync(fd) ; |