diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-11 16:09:55 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-11 16:09:55 +0000 |
commit | 5ad27a3dc4b957191e2e657d41656810138ba789 (patch) | |
tree | 07e7e00ab43b74d6a3fdff9ad80e93882921adfa /src/skadns/skadns_update.c | |
parent | f417b72c9489cd7c20b94eb8904a8911b7f6fd15 (diff) | |
download | s6-dns-5ad27a3dc4b957191e2e657d41656810138ba789.tar.xz |
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/skadns/skadns_update.c')
-rw-r--r-- | src/skadns/skadns_update.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/skadns/skadns_update.c b/src/skadns/skadns_update.c index 73edba2..24b1e2e 100644 --- a/src/skadns/skadns_update.c +++ b/src/skadns/skadns_update.c @@ -1,15 +1,16 @@ /* ISC license. */ -/* OpenBSD sucks */ +/* Hey, OpenBSD, are you aware ECANCELED is POSIX? */ #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif +#include <string.h> +#include <stdint.h> #include <errno.h> #include <skalibs/error.h> -#include <skalibs/uint16.h> +#include <skalibs/types.h> #include <skalibs/alloc.h> -#include <skalibs/bytestr.h> #include <skalibs/genalloc.h> #include <skalibs/gensetdyn.h> #include <skalibs/unixmessage.h> @@ -20,7 +21,7 @@ static int msghandler (unixmessage_t const *m, void *context) { skadns_t *a = (skadns_t *)context ; skadnsanswer_t *p ; - uint16 id ; + uint16_t id ; if (m->len < 3 || m->nfds) return (errno = EPROTO, 0) ; uint16_unpack_big(m->s, &id) ; p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ; @@ -30,21 +31,21 @@ static int msghandler (unixmessage_t const *m, void *context) return gensetdyn_delete(&a->q, id) ; } if (!error_isagain(p->status)) return (errno = EINVAL, 0) ; - if (!genalloc_readyplus(uint16, &a->list, 1)) return 0 ; + if (!genalloc_readyplus(uint16_t, &a->list, 1)) return 0 ; if (!m->s[2]) { p->data = alloc(m->len-3) ; if (!p->data) return 0 ; - byte_copy(p->data, m->len-3, m->s+3) ; + memcpy(p->data, m->s+3, m->len-3) ; p->len = m->len-3 ; } p->status = m->s[2] ; - genalloc_append(uint16, &a->list, &id) ; + genalloc_append(uint16_t, &a->list, &id) ; return 1 ; } int skadns_update (skadns_t *a) { - genalloc_setlen(uint16, &a->list, 0) ; + genalloc_setlen(uint16_t, &a->list, 0) ; return skaclient_update(&a->connection, &msghandler, a) ; } |