diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2022-05-06 21:25:38 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2022-05-06 21:25:38 +0200 |
commit | 8d8f1f264e758707a6997bd0b3ed78aec60ef9c9 (patch) | |
tree | 2a53ac9fc4f759f6e7c5dc68b85042a96ffe6d43 /ircxmpp.c | |
parent | 0.0.6 (diff) | |
download | ircxmpp-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.c | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -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); } |