summaryrefslogtreecommitdiffstats
path: root/ircxmpp.c
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-05-06 21:25:38 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-05-06 21:25:38 +0200
commit8d8f1f264e758707a6997bd0b3ed78aec60ef9c9 (patch)
tree2a53ac9fc4f759f6e7c5dc68b85042a96ffe6d43 /ircxmpp.c
parent0.0.6 (diff)
downloadircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.tar
ircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.tar.gz
ircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.tar.bz2
ircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.tar.lz
ircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.tar.xz
ircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.tar.zst
ircxmpp-8d8f1f264e758707a6997bd0b3ed78aec60ef9c9.zip
Diffstat (limited to 'ircxmpp.c')
-rw-r--r--ircxmpp.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/ircxmpp.c b/ircxmpp.c
index d04ee3e..09d9d46 100644
--- a/ircxmpp.c
+++ b/ircxmpp.c
@@ -810,17 +810,20 @@ int main (void) {
if (getenv(b))
domain = getenv(b);
}
- struct dns * dns = dns_init();
- char buf[512+strlen(domain)];
- strcpy(buf, "ircxmpp.no.domain.set.yet.");
- strcat(buf, domain);
- dns_set_domain(dns, buf);
- if (getenv("IX_DNS_PORT"))
- dns_set_port(dns, atoi(getenv("IX_DNS_PORT")));
- if (getenv("IX_DNS_IP"))
- dns_set_ip(dns, getenv("IX_DNS_IP"));
- dns_set_log_handler(dns, dns_default_log_handler);
- dns_set_log_userdata(dns, NULL); // so we don't read uninitialized values
+ struct dns * dns = NULL;
+ if (domain) {
+ dns = dns_init();
+ char buf[512+strlen(domain)];
+ strcpy(buf, "ircxmpp.no.domain.set.yet.");
+ strcat(buf, domain);
+ dns_set_domain(dns, buf);
+ if (getenv("IX_DNS_PORT"))
+ dns_set_port(dns, atoi(getenv("IX_DNS_PORT")));
+ if (getenv("IX_DNS_IP"))
+ dns_set_ip(dns, getenv("IX_DNS_IP"));
+ dns_set_log_handler(dns, dns_default_log_handler);
+ dns_set_log_userdata(dns, NULL); // so we don't read uninitialized values
+ }
signal(SIGTERM, signalhandler);
signal(SIGINT, signalhandler);
// signal(SIGPIPE, SIG_IGN);
@@ -831,7 +834,7 @@ int main (void) {
.tv_sec = 0,
.tv_nsec = getenv("IX_LOOPDELAY") ? atoi(getenv("IX_LOOPDELAY"))/1000 : 1e7
};
- if (domain)
+ if (dns)
dns_run_once(dns);
nanosleep(&ts, NULL);
}