diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-09-02 19:11:11 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-09-02 19:11:11 +0000 |
commit | d9488baa63351cafd237f5af15018ea5898ec0bc (patch) | |
tree | 9704741988528c28a8cb51c1e60fae56d712ab6d | |
parent | 208dc53700866d413efaf7374ebd9dbaeaee6551 (diff) | |
download | s6-d9488baa63351cafd237f5af15018ea5898ec0bc.tar.xz |
Pass errno as unsigned char
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | src/include/s6/lock.h | 2 | ||||
-rw-r--r-- | src/libs6/s6-ftrigrd.c | 4 | ||||
-rw-r--r-- | src/libs6/s6_fdholder_delete.c | 2 | ||||
-rw-r--r-- | src/libs6/s6_fdholder_getdump.c | 2 | ||||
-rw-r--r-- | src/libs6/s6_fdholder_setdump.c | 8 | ||||
-rw-r--r-- | src/libs6/s6_fdholder_store.c | 2 | ||||
-rw-r--r-- | src/libs6/s6lock_acquire.c | 2 | ||||
-rw-r--r-- | src/libs6/s6lock_check.c | 2 | ||||
-rw-r--r-- | src/libs6/s6lock_release.c | 2 | ||||
-rw-r--r-- | src/libs6/s6lock_update.c | 4 | ||||
-rw-r--r-- | src/libs6/s6lockd.c | 6 |
11 files changed, 18 insertions, 18 deletions
diff --git a/src/include/s6/lock.h b/src/include/s6/lock.h index e87e001..766a0a1 100644 --- a/src/include/s6/lock.h +++ b/src/include/s6/lock.h @@ -31,7 +31,7 @@ struct s6lock_s { textclient connection ; genalloc list ; /* array of uint16_t */ - gensetdyn data ; /* set of char */ + gensetdyn data ; /* set of unsigned char */ } ; #define S6LOCK_ZERO { .connection = TEXTCLIENT_ZERO, .list = GENALLOC_ZERO, .data = GENSETDYN_INIT(int, 2, 0, 1) } extern s6lock_t const s6lock_zero ; diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c index e8affd6..00e7703 100644 --- a/src/libs6/s6-ftrigrd.c +++ b/src/libs6/s6-ftrigrd.c @@ -74,9 +74,9 @@ static void trig (uint16_t id, char what, char info) } } -static void answer (char c) +static void answer (unsigned char c) { - if (!textmessage_put(textmessage_sender_1, &c, 1)) + if (!textmessage_put(textmessage_sender_1, (char *)&c, 1)) { cleanup() ; strerr_diefu1sys(111, "textmessage_put") ; diff --git a/src/libs6/s6_fdholder_delete.c b/src/libs6/s6_fdholder_delete.c index 585722d..c460d1d 100644 --- a/src/libs6/s6_fdholder_delete.c +++ b/src/libs6/s6_fdholder_delete.c @@ -21,5 +21,5 @@ int s6_fdholder_delete (s6_fdholder_t *a, char const *id, tain const *deadline, unixmessage_drop(&m) ; return (errno = EPROTO, 0) ; } - return m.s[0] ? (errno = m.s[0], 0) : 1 ; + return m.s[0] ? (errno = (unsigned char)m.s[0], 0) : 1 ; } diff --git a/src/libs6/s6_fdholder_getdump.c b/src/libs6/s6_fdholder_getdump.c index b24ed02..8c0312d 100644 --- a/src/libs6/s6_fdholder_getdump.c +++ b/src/libs6/s6_fdholder_getdump.c @@ -26,7 +26,7 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain const *deadline, ta if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (!m.len || m.nfds) return (errno = EPROTO, 0) ; - if (m.s[0]) return (errno = m.s[0], 0) ; + if (m.s[0]) return (errno = (unsigned char)m.s[0], 0) ; if (m.len != 9) return (errno = EPROTO, 0) ; uint32_unpack_big(m.s + 1, &n) ; uint32_unpack_big(m.s + 5, &ntot) ; diff --git a/src/libs6/s6_fdholder_setdump.c b/src/libs6/s6_fdholder_setdump.c index 9c88f6b..e1462ef 100644 --- a/src/libs6/s6_fdholder_setdump.c +++ b/src/libs6/s6_fdholder_setdump.c @@ -34,7 +34,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (!m.len || m.nfds) { unixmessage_drop(&m) ; return (errno = EPROTO, 0) ; } - if (m.s[0]) return (errno = m.s[0], 0) ; + if (m.s[0]) return (errno = (unsigned char)m.s[0], 0) ; if (m.len != 5) return (errno = EPROTO, 0) ; uint32_unpack_big(m.s + 1, &trips) ; if (trips != 1 + (ntot-1) / UNIXMESSAGE_MAXFDS) return (errno = EPROTO, 0) ; @@ -71,10 +71,10 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne unixmessage_drop(&m) ; return (errno = EPROTO, 0) ; } - if (!error_isagain(m.s[0]) && i < trips-1) - return errno = m.s[0] ? m.s[0] : EPROTO, 0 ; + if (!error_isagain((unsigned char)m.s[0]) && i < trips-1) + return errno = m.s[0] ? (unsigned char)m.s[0] : EPROTO, 0 ; if (i == trips - 1 && m.s[0]) - return errno = error_isagain(m.s[0]) ? EPROTO : m.s[0], 0 ; + return errno = error_isagain((unsigned char)m.s[0]) ? EPROTO : (unsigned char)m.s[0], 0 ; } } return 1 ; diff --git a/src/libs6/s6_fdholder_store.c b/src/libs6/s6_fdholder_store.c index d765df4..40d660a 100644 --- a/src/libs6/s6_fdholder_store.c +++ b/src/libs6/s6_fdholder_store.c @@ -21,5 +21,5 @@ int s6_fdholder_store (s6_fdholder_t *a, int fd, char const *id, tain const *lim unixmessage_drop(&m) ; return (errno = EPROTO, 0) ; } - return m.s[0] ? (errno = m.s[0], 0) : 1 ; + return m.s[0] ? (errno = (unsigned char)m.s[0], 0) : 1 ; } diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c index fa500aa..890f892 100644 --- a/src/libs6/s6lock_acquire.c +++ b/src/libs6/s6lock_acquire.c @@ -35,7 +35,7 @@ int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options errno = e ; return 0 ; } - *GENSETDYN_P(char, &a->data, i) = EAGAIN ; + *GENSETDYN_P(unsigned char, &a->data, i) = EAGAIN ; *u = i ; return 1 ; } diff --git a/src/libs6/s6lock_check.c b/src/libs6/s6lock_check.c index b62d790..0602d40 100644 --- a/src/libs6/s6lock_check.c +++ b/src/libs6/s6lock_check.c @@ -7,7 +7,7 @@ int s6lock_check (s6lock_t *a, uint16_t id) { - char *p = GENSETDYN_P(char, &a->data, id) ; + unsigned char *p = GENSETDYN_P(unsigned char, &a->data, id) ; switch (*p) { case EBUSY : return 1 ; diff --git a/src/libs6/s6lock_release.c b/src/libs6/s6lock_release.c index 96fa3d0..2c045a6 100644 --- a/src/libs6/s6lock_release.c +++ b/src/libs6/s6lock_release.c @@ -9,7 +9,7 @@ int s6lock_release (s6lock_t *a, uint16_t i, tain const *deadline, tain *stamp) { - char *p = GENSETDYN_P(char, &a->data, i) ; + unsigned char *p = GENSETDYN_P(unsigned char, &a->data, i) ; char pack[3] = "-->" ; if ((*p != EBUSY) && !error_isagain(*p)) { diff --git a/src/libs6/s6lock_update.c b/src/libs6/s6lock_update.c index 4866e7c..e345230 100644 --- a/src/libs6/s6lock_update.c +++ b/src/libs6/s6lock_update.c @@ -18,11 +18,11 @@ static int msghandler (struct iovec const *v, void *context) { s6lock_t *a = (s6lock_t *)context ; char const *s = v->iov_base ; - char *p ; + unsigned char *p ; uint16_t id ; if (v->iov_len != 3) return (errno = EPROTO, 0) ; uint16_unpack_big(s, &id) ; - p = GENSETDYN_P(char, &a->data, id) ; + p = GENSETDYN_P(unsigned char, &a->data, id) ; if (*p == EBUSY) *p = s[2] ; else if (error_isagain(*p)) *p = s[2] ? s[2] : EBUSY ; else return (errno = EPROTO, 0) ; diff --git a/src/libs6/s6lockd.c b/src/libs6/s6lockd.c index 8724019..285fb47 100644 --- a/src/libs6/s6lockd.c +++ b/src/libs6/s6lockd.c @@ -56,7 +56,7 @@ static void cleanup (void) genalloc_setlen(s6lockio_t, &a, 0) ; } -static void trig (uint16_t id, char e) +static void trig (uint16_t id, unsigned char e) { char pack[3] ; uint16_pack_big(pack, id) ; @@ -68,9 +68,9 @@ static void trig (uint16_t id, char e) } } -static void answer (char c) +static void answer (unsigned char c) { - if (!textmessage_put(textmessage_sender_1, &c, 1)) + if (!textmessage_put(textmessage_sender_1, (char *)&c, 1)) { cleanup() ; strerr_diefu1sys(111, "textmessage_put") ; |