From 967b7e75e3483c9bb2d17178237e7655c3f3beb2 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 2 Dec 2020 10:57:57 -0600 Subject: [PATCH] resolve: Handle empty dns/domain lists In the strange case that the dns list or the domain list are empty and openresolv is being used, delete the openresolv entry instance instead of trying to set it to an empty value --- src/resolve.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/resolve.c b/src/resolve.c index 1d211937..d3b483a8 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -406,6 +406,14 @@ static void resolve_resolvconf_set_dns(struct resolve *resolve, char **dns_list) if (L_WARN_ON(!resolvconf_path)) return; + if (!dns_list || !dns_list[0]) { + if (rc->have_dns) + resolvconf_invoke(rc->ifname, "dns", NULL); + + rc->have_dns = false; + return; + } + content = l_string_new(0); for (; *dns_list; dns_list++) @@ -428,6 +436,14 @@ static void resolve_resolvconf_set_domains(struct resolve *resolve, if (L_WARN_ON(!resolvconf_path)) return; + if (!domain_list || !domain_list[0]) { + if (rc->have_domain) + resolvconf_invoke(rc->ifname, "domain", NULL); + + rc->have_domain = false; + return; + } + content = l_string_new(0); for (; *domain_list; domain_list++)