summaryrefslogtreecommitdiffstats
path: root/dns.c
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-05-06 23:18:39 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-05-06 23:18:39 +0200
commit7c30a3763add5b789f5434b43bed750318d7254f (patch)
tree83bf2f27c1a178daa099e3ac111f8063a718b213 /dns.c
parent0.0.7 (diff)
downloadircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.tar
ircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.tar.gz
ircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.tar.bz2
ircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.tar.lz
ircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.tar.xz
ircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.tar.zst
ircxmpp-7c30a3763add5b789f5434b43bed750318d7254f.zip
Diffstat (limited to 'dns.c')
-rw-r--r--dns.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/dns.c b/dns.c
index 97ea778..8646339 100644
--- a/dns.c
+++ b/dns.c
@@ -106,6 +106,8 @@ static void dns_default_log_handler (void * const u __attribute__((unused)),
}
struct dns * dns_init (void) {
struct dns * dns = calloc(1, sizeof(struct dns));
+ if (!dns)
+ return NULL;
dns->fd = -1;
dns->domain = strdup(" call dns_set_domain to set the domain");
dns->domain[0] = strlen(dns->domain)-1;
@@ -217,12 +219,14 @@ static void dns_run_once (struct dns * dns) {
dns->log_handler(dns->log_userdata, DNS_ERROR, "dns", buf);
}
static void dns_free (struct dns * dns) {
+ if (!dns)
+ return;
if (dns->fd != -1)
close (dns->fd);
free(dns->domain);
free(dns);
}
-#if __INCLUDE_LEVEL__ == 0
+#if IX_DNS_MAIN
int shouldexit = 0;
void handler (int signal __attribute__((unused))) {
shouldexit++;