blob: 0cd4dc008fe039472b68aeea148edd813d6a7a9e (
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
27
28
29
30
31
|
/* ISC license. */
/* OpenBSD sucks */
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#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) ;
}
|