summaryrefslogtreecommitdiff
path: root/src/skadns/skadns_cancel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/skadns/skadns_cancel.c')
-rw-r--r--src/skadns/skadns_cancel.c11
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 ;
}