summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-answer.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-11 15:10:56 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-11 15:10:56 +0100
commit29c1519ed4899d139fa7b2079311cff6c4fb64a8 (patch)
tree5a874c08bd80fc886c9481e59037df246a87c0f8 /src/resolve/resolved-dns-answer.c
parent56352fe92d0bf4310699b93427ab4fb1d44e5312 (diff)
resolved: don't eat up errors
dns_resource_key_match_soa() and dns_resource_key_match_cname_or_dname() may return errors as negative return values. Make sure to propagate those.
Diffstat (limited to 'src/resolve/resolved-dns-answer.c')
-rw-r--r--src/resolve/resolved-dns-answer.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/resolve/resolved-dns-answer.c b/src/resolve/resolved-dns-answer.c
index 55e6ffbad7..6a37345e7e 100644
--- a/src/resolve/resolved-dns-answer.c
+++ b/src/resolve/resolved-dns-answer.c
@@ -228,9 +228,9 @@ int dns_answer_contains_rr(DnsAnswer *a, DnsResourceRecord *rr) {
int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret) {
DnsResourceRecord *rr;
+ int r;
assert(key);
- assert(ret);
if (!a)
return 0;
@@ -240,8 +240,12 @@ int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceReco
return 0;
DNS_ANSWER_FOREACH(rr, a) {
- if (dns_resource_key_match_soa(key, rr->key)) {
- *ret = rr;
+ r = dns_resource_key_match_soa(key, rr->key);
+ if (r < 0)
+ return r;
+ if (r > 0) {
+ if (ret)
+ *ret = rr;
return 1;
}
}
@@ -251,6 +255,7 @@ int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceReco
int dns_answer_find_cname_or_dname(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret) {
DnsResourceRecord *rr;
+ int r;
assert(key);
@@ -262,7 +267,10 @@ int dns_answer_find_cname_or_dname(DnsAnswer *a, const DnsResourceKey *key, DnsR
return 0;
DNS_ANSWER_FOREACH(rr, a) {
- if (dns_resource_key_match_cname_or_dname(key, rr->key, NULL)) {
+ r = dns_resource_key_match_cname_or_dname(key, rr->key, NULL);
+ if (r < 0)
+ return r;
+ if (r > 0) {
if (ret)
*ret = rr;
return 1;