From c3f353450e94248ee677a068ed2c4ed29d64f79e Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Thu, 5 Sep 2019 23:31:19 +0300 Subject: [PATCH] Fix checking return value of the evdns_base_resolv_conf_parse() Reported-by: Maxim Gorbachyov --- evdns.c | 2 +- sample/dns-example.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/evdns.c b/evdns.c index de3848ad..0e8db53a 100644 --- 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; } diff --git a/sample/dns-example.c b/sample/dns-example.c index 21a75de8..2d07c387 100644 --- a/sample/dns-example.c +++ b/sample/dns-example.c @@ -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; } } -- 2.40.0