From 8d8f1f264e758707a6997bd0b3ed78aec60ef9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Fri, 6 May 2022 21:25:38 +0200 Subject: 0.0.7 --- ircxmpp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'ircxmpp.c') 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); } -- cgit v1.2.3