diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-09-02 17:00:05 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-09-02 17:00:05 +0000 |
commit | 38de045079736def92d26186e09fe8db3d82c4b0 (patch) | |
tree | 2c123ce20ed29488de437aaa8c01f24e78ed340e /src | |
parent | 172a3c0321f90fe5e8118d35e8c24cc8aa4bb4de (diff) | |
download | utmps-38de045079736def92d26186e09fe8db3d82c4b0.tar.xz |
Pass errno as unsigned char
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/utmps/utmps_getent.c | 2 | ||||
-rw-r--r-- | src/utmps/utmps_getid.c | 2 | ||||
-rw-r--r-- | src/utmps/utmps_getline.c | 2 | ||||
-rw-r--r-- | src/utmps/utmps_putline.c | 2 | ||||
-rw-r--r-- | src/utmps/utmps_rewind.c | 4 | ||||
-rw-r--r-- | src/utmps/utmps_updwtmpx.c | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/src/utmps/utmps_getent.c b/src/utmps/utmps_getent.c index 7b98c34..91e6366 100644 --- a/src/utmps/utmps_getent.c +++ b/src/utmps/utmps_getent.c @@ -15,7 +15,7 @@ int utmps_getent (utmps *a, struct utmpx *b, tain const *deadline, tain *stamp) r = ipc_timed_recv(a->fd, buf, sizeof(buf), 0, deadline, stamp) ; if (r < 0) return 0 ; if (!r) return (errno = EPIPE, 0) ; - if (buf[0]) return (errno = buf[0], 0) ; + if (buf[0]) return (errno = (unsigned char)buf[0], 0) ; utmps_utmpx_unpack(buf + 1, b) ; return 1 ; } diff --git a/src/utmps/utmps_getid.c b/src/utmps/utmps_getid.c index b07b989..90e7d2a 100644 --- a/src/utmps/utmps_getid.c +++ b/src/utmps/utmps_getid.c @@ -21,7 +21,7 @@ int utmps_getid (utmps *a, unsigned short type, char const *id, struct utmpx *b, r = ipc_timed_recv(a->fd, rbuf, sizeof(rbuf), 0, deadline, stamp) ; if (r < 0) return 0 ; if (!r) return (errno = EPIPE, 0) ; - if (rbuf[0]) return (errno = rbuf[0], 0) ; + if (rbuf[0]) return (errno = (unsigned char)rbuf[0], 0) ; utmps_utmpx_unpack(rbuf + 1, b) ; return 1 ; } diff --git a/src/utmps/utmps_getline.c b/src/utmps/utmps_getline.c index cb7c984..6375f5d 100644 --- a/src/utmps/utmps_getline.c +++ b/src/utmps/utmps_getline.c @@ -19,7 +19,7 @@ int utmps_getline (utmps *a, char const *line, struct utmpx *b, tain const *dead r = ipc_timed_recv(a->fd, rbuf, sizeof(rbuf), 0, deadline, stamp) ; if (r < 0) return 0 ; if (!r) return (errno = EPIPE, 0) ; - if (rbuf[0]) return (errno = rbuf[0], 0) ; + if (rbuf[0]) return (errno = (unsigned char)rbuf[0], 0) ; utmps_utmpx_unpack(rbuf + 1, b) ; return 1 ; } diff --git a/src/utmps/utmps_putline.c b/src/utmps/utmps_putline.c index 04ed540..8324a3b 100644 --- a/src/utmps/utmps_putline.c +++ b/src/utmps/utmps_putline.c @@ -17,6 +17,6 @@ int utmps_putline (utmps *a, struct utmpx const *b, tain const *deadline, tain * r = ipc_timed_recv(a->fd, buf, 1, 0, deadline, stamp) ; if (r < 0) return 0 ; if (!r) return (errno = EPIPE, 0) ; - if (buf[0]) return (errno = buf[0], 0) ; + if (buf[0]) return (errno = (unsigned char)buf[0], 0) ; return 1 ; } diff --git a/src/utmps/utmps_rewind.c b/src/utmps/utmps_rewind.c index fe3c8ed..5c16cd6 100644 --- a/src/utmps/utmps_rewind.c +++ b/src/utmps/utmps_rewind.c @@ -9,9 +9,9 @@ int utmps_rewind (utmps *a, tain const *deadline, tain *stamp) { ssize_t r ; - char c ; + unsigned char c ; if (!ipc_timed_send(a->fd, "r", 1, deadline, stamp)) return 0 ; - r = ipc_timed_recv(a->fd, &c, 1, 0, deadline, stamp) ; + r = ipc_timed_recv(a->fd, (char *)&c, 1, 0, deadline, stamp) ; if (r < 0) return 0 ; if (!r) return (errno = EPIPE, 0) ; if (c) return (errno = c, 0) ; diff --git a/src/utmps/utmps_updwtmpx.c b/src/utmps/utmps_updwtmpx.c index 5b0557e..33dd9bc 100644 --- a/src/utmps/utmps_updwtmpx.c +++ b/src/utmps/utmps_updwtmpx.c @@ -18,7 +18,7 @@ int utmps_updwtmpx (char const *path, struct utmpx const *b, tain const *deadlin r = ipc_timed_recv(a.fd, buf, 1, 0, deadline, stamp) ; if (r < 0) goto err ; if (!r) { errno = EPIPE ; goto err ; } - if (buf[0]) { errno = buf[0] ; goto err ; } + if (buf[0]) { errno = (unsigned char)buf[0] ; goto err ; } utmps_end(&a) ; return 1 ; |