summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-18 19:31:21 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-18 19:31:21 +0100
commitea207b639a379b2a0bb8f2cafb0893e406c6152e (patch)
tree041e2e52cd7e366b7d379a6f9a58fbc0c8636d9a
parenteed749cca62983df3290dd46b423e59c7b039f42 (diff)
resolved: properly determine size of DnsAnswer object
After all we want to allow NULL DnsAnswer objects as equivalent to empty ones, hence we should use the right checks everywhere.
-rw-r--r--src/resolve/resolved-dns-cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-cache.c b/src/resolve/resolved-dns-cache.c
index 451875ece0..84ae8b59f9 100644
--- a/src/resolve/resolved-dns-cache.c
+++ b/src/resolve/resolved-dns-cache.c
@@ -477,7 +477,7 @@ int dns_cache_put(
dns_cache_remove(c, key);
}
- if (!answer) {
+ if (dns_answer_size(answer) <= 0) {
if (log_get_max_level() >= LOG_DEBUG) {
_cleanup_free_ char *key_str = NULL;
@@ -506,7 +506,7 @@ int dns_cache_put(
if (!IN_SET(rcode, DNS_RCODE_SUCCESS, DNS_RCODE_NXDOMAIN))
return 0;
- cache_keys = answer->n_rrs;
+ cache_keys = dns_answer_size(answer);
if (key)
cache_keys ++;