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_send.c | |
parent | f417b72c9489cd7c20b94eb8904a8911b7f6fd15 (diff) | |
download | s6-dns-5ad27a3dc4b957191e2e657d41656810138ba789.tar.xz |
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/skadns/skadns_send.c')
-rw-r--r-- | src/skadns/skadns_send.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/skadns/skadns_send.c b/src/skadns/skadns_send.c index f485c92..35177c2 100644 --- a/src/skadns/skadns_send.c +++ b/src/skadns/skadns_send.c @@ -1,10 +1,10 @@ /* ISC license. */ +#include <sys/uio.h> +#include <string.h> #include <stdint.h> #include <errno.h> -#include <skalibs/uint16.h> -#include <skalibs/bytestr.h> -#include <skalibs/siovec.h> +#include <skalibs/types.h> #include <skalibs/tai.h> #include <skalibs/stralloc.h> #include <skalibs/gensetdyn.h> @@ -19,14 +19,19 @@ int skadns_send (skadns_t *a, uint16_t *u, s6dns_domain_t const *d, uint16_t qty unsigned int i ; char tmp[17] = "--Q" ; char err ; - siovec_t v[2] = { { .s = tmp, .len = 17 }, { .s = (char *)d->s, .len = d->len } } ; + struct iovec v[2] = { { .iov_base = tmp, .iov_len = 17 }, { .iov_base = (void *)d->s, .iov_len = d->len } } ; if (!gensetdyn_new(&a->q, &i)) return 0 ; + if (i > UINT16_MAX) + { + gensetdyn_delete(&a->q, i) ; + return (errno = EMFILE, 0) ; + } uint16_pack_big(tmp, (uint16_t)i) ; uint16_pack_big(tmp + 3, qtype) ; - if (limit) tain_pack(tmp + 5, limit) ; else byte_zero(tmp + 5, 12) ; + if (limit) tain_pack(tmp + 5, limit) ; else memset(tmp + 5, 0, 12) ; if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp)) { - register int e = errno ; + int e = errno ; gensetdyn_delete(&a->q, i) ; errno = e ; return 0 ; |