resolved: take benefit of log_xyz_errno() returning the negative error code

Just some modernizations.
This commit is contained in:
Lennart Poettering 2017-10-04 11:57:10 +02:00
parent c9905d4dd2
commit 9886b6b13c
1 changed files with 6 additions and 12 deletions

View File

@ -86,27 +86,21 @@ static int mdns_scope_process_query(DnsScope *s, DnsPacket *p) {
key = p->question->keys[0];
r = dns_zone_lookup(&s->zone, key, 0, &answer, &soa, &tentative);
if (r < 0) {
log_debug_errno(r, "Failed to lookup key: %m");
return r;
}
if (r < 0)
return log_debug_errno(r, "Failed to lookup key: %m");
if (r == 0)
return 0;
r = dns_scope_make_reply_packet(s, DNS_PACKET_ID(p), DNS_RCODE_SUCCESS, NULL, answer, NULL, false, &reply);
if (r < 0) {
log_debug_errno(r, "Failed to build reply packet: %m");
return r;
}
if (r < 0)
return log_debug_errno(r, "Failed to build reply packet: %m");
if (!ratelimit_test(&s->ratelimit))
return 0;
r = dns_scope_emit_udp(s, -1, reply);
if (r < 0) {
log_debug_errno(r, "Failed to send reply packet: %m");
return r;
}
if (r < 0)
return log_debug_errno(r, "Failed to send reply packet: %m");
return 0;
}