blob: 9fba737d5f010da60bc838fa581c704927dcc594 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* ISC license. */
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/alloc.h>
#include <skalibs/gensetdyn.h>
#include <s6-dns/skadns.h>
int skadns_release (skadns_t *a, uint16 id)
{
register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
switch (p->status)
{
case 0 :
alloc_free(p->data) ; p->data = 0 ; p->len = 0 ;
break ;
case EAGAIN :
case ECANCELED :
return (errno = EBUSY, 0) ;
case EINVAL :
return (errno = EINVAL, 0) ;
default : break ;
}
p->status = EINVAL ;
return gensetdyn_delete(&a->q, id) ;
}
|