1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-05 09:17:44 +03:00

resolved: properly handle adding empty replies to cache

This commit is contained in:
Lennart Poettering 2014-07-30 14:21:18 +02:00
parent 6bf02ccb14
commit 0ec7c46eed

View File

@ -352,12 +352,16 @@ int dns_cache_put(DnsCache *c, DnsQuestion *q, int rcode, DnsAnswer *answer, uns
int r;
assert(c);
assert(answer);
assert(q);
/* First, delete all matching old RRs, so that we only keep
* complete by_key in place. */
for (i = 0; i < q->n_keys; i++)
dns_cache_remove(c, q->keys[i]);
if (!answer)
return 0;
for (i = 0; i < answer->n_rrs; i++)
dns_cache_remove(c, answer->rrs[i]->key);