Mercurial > dnsbl
diff src/dnsbl.cpp @ 223:da9e7f1c8160
fix unsigned signed compare, back to mixed -lresolv and libresolv.a with auto requires
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sun, 28 Dec 2008 09:15:25 -0800 |
parents | b2a7ca398712 |
children | 8e1cbf3d96fc |
line wrap: on
line diff
--- a/src/dnsbl.cpp Sun Dec 28 08:34:14 2008 -0800 +++ b/src/dnsbl.cpp Sun Dec 28 09:15:25 2008 -0800 @@ -532,8 +532,9 @@ snprintf(text, sizeof(text), "process_resolver_requests() has a question %s", question); my_syslog(text); #endif - glom.length = res_search(question, ns_c_in, ns_t_a, glom.answer, sizeof(glom.answer)); - if (glom.length < 0) glom.length = 0; // represent all errors as zero length answers + int res_result = res_search(question, ns_c_in, ns_t_a, glom.answer, sizeof(glom.answer)); + if (res_result < 0) glom.length = 0; // represent all errors as zero length answers + else glom.length = (size_t)res_result; #else glom.length = sizeof(glom.answer); glom.answer = 0; @@ -611,7 +612,7 @@ snprintf(text, sizeof(text), "dns_interface() wrote question %s and has answer length %d", question, glom.length); my_syslog(text); #endif - if ((glom.length < 0) || (glom.length > sizeof(glom.answer))) { + if ((glom.length == 0) || (glom.length > sizeof(glom.answer))) { priv.err = true; return 0; // cannot process overlarge answers } @@ -622,7 +623,6 @@ // stepping on each other while parsing the dns answer. int ret_address = 0; pthread_mutex_lock(&resolve_mutex); - if (glom.length > 0) { // parse the answer ns_msg handle; ns_rr rr; @@ -682,7 +682,6 @@ } } } - } pthread_mutex_unlock(&resolve_mutex); #ifdef RESOLVER_DEBUG snprintf(text, sizeof(text), "dns_interface() found ip %d", ret_address);