diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-12-22 16:07:12 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-12-22 16:07:12 +0000 |
commit | 275183baefa08dc91f094c1e59bd43a77684662d (patch) | |
tree | 2aeeb04d0c650afd05ad42de8f4f1f708527aa2e /src/skadns/skadns_cancel.c | |
parent | 6f2f670455a24032face2d8ee4684d051ae0e907 (diff) | |
download | s6-dns-275183baefa08dc91f094c1e59bd43a77684662d.tar.xz |
Port skadns to textclient, prepare for 2.3.0.0
Diffstat (limited to 'src/skadns/skadns_cancel.c')
-rw-r--r-- | src/skadns/skadns_cancel.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/skadns/skadns_cancel.c b/src/skadns/skadns_cancel.c index 8a4ec7c..c5062f6 100644 --- a/src/skadns/skadns_cancel.c +++ b/src/skadns/skadns_cancel.c @@ -9,19 +9,20 @@ #include <skalibs/uint16.h> #include <skalibs/error.h> #include <skalibs/gensetdyn.h> -#include <skalibs/skaclient.h> +#include <skalibs/textclient.h> #include <s6-dns/skadns.h> int skadns_cancel (skadns_t *a, uint16_t id, tain_t const *deadline, tain_t *stamp) { + int e = errno ; char pack[3] = "--q" ; - char err ; skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ; if (!error_isagain(p->status)) return skadns_release(a, id) ; uint16_pack_big(pack, id) ; - if (!skaclient_send(&a->connection, pack, 3, &skaclient_default_cb, &err, deadline, stamp)) return 0 ; - if (!err) return gensetdyn_delete(&a->q, id) ; - if (err != ENOENT) return (errno = err, 0) ; + if (textclient_command(&a->connection, pack, 3, deadline, stamp)) + return gensetdyn_delete(&a->q, id) ; + if (errno != ENOENT) return 0 ; p->status = ECANCELED ; + errno = e ; return 1 ; } |