]> granicus.if.org Git - libevent/commitdiff
Fix checking return value of the evdns_base_resolv_conf_parse()
authorAzat Khuzhin <azat@libevent.org>
Thu, 5 Sep 2019 20:31:19 +0000 (23:31 +0300)
committerAzat Khuzhin <azat@libevent.org>
Thu, 5 Sep 2019 20:32:40 +0000 (23:32 +0300)
Reported-by: Maxim Gorbachyov <maxim.gorbachyov@gmail.com>
evdns.c
sample/dns-example.c

diff --git a/evdns.c b/evdns.c
index de3848ad18ce68354445f87962110a20db2f7e49..0e8db53a5d5dae892a2403c7e786ea1bcc7e17d3 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -4032,7 +4032,7 @@ evdns_base_new(struct event_base *event_base, int flags)
 #else
                r = evdns_base_resolv_conf_parse(base, opts, "/etc/resolv.conf");
 #endif
-               if (r == -1) {
+               if (r) {
                        evdns_base_free_and_unlock(base, 0);
                        return NULL;
                }
index 21a75de8635663ff992e7f9fad8e5e789609815d..2d07c3874bcaada1b376e74bc10ad5f4f10857a9 100644 (file)
@@ -225,8 +225,8 @@ main(int c, char **v) {
                        res = evdns_base_resolv_conf_parse(evdns_base,
                            DNS_OPTION_NAMESERVERS, o.resolv_conf);
 
-               if (res < 0) {
-                       fprintf(stderr, "Couldn't configure nameservers");
+               if (res) {
+                       fprintf(stderr, "Couldn't configure nameservers\n");
                        return 1;
                }
        }