mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 15:21:37 +03:00
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.
This commit is contained in:
parent
56352fe92d
commit
29c1519ed4
@ -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) {
|
int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret) {
|
||||||
DnsResourceRecord *rr;
|
DnsResourceRecord *rr;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(key);
|
assert(key);
|
||||||
assert(ret);
|
|
||||||
|
|
||||||
if (!a)
|
if (!a)
|
||||||
return 0;
|
return 0;
|
||||||
@ -240,8 +240,12 @@ int dns_answer_find_soa(DnsAnswer *a, const DnsResourceKey *key, DnsResourceReco
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DNS_ANSWER_FOREACH(rr, a) {
|
DNS_ANSWER_FOREACH(rr, a) {
|
||||||
if (dns_resource_key_match_soa(key, rr->key)) {
|
r = dns_resource_key_match_soa(key, rr->key);
|
||||||
*ret = rr;
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
if (r > 0) {
|
||||||
|
if (ret)
|
||||||
|
*ret = rr;
|
||||||
return 1;
|
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) {
|
int dns_answer_find_cname_or_dname(DnsAnswer *a, const DnsResourceKey *key, DnsResourceRecord **ret) {
|
||||||
DnsResourceRecord *rr;
|
DnsResourceRecord *rr;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(key);
|
assert(key);
|
||||||
|
|
||||||
@ -262,7 +267,10 @@ int dns_answer_find_cname_or_dname(DnsAnswer *a, const DnsResourceKey *key, DnsR
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DNS_ANSWER_FOREACH(rr, a) {
|
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)
|
if (ret)
|
||||||
*ret = rr;
|
*ret = rr;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user