summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 13:19:16 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 13:29:21 +0100
commitda927ba997d68401563b927f92e6e40e021a8e5c (patch)
tree71764cd998aef07b8943c5206c9307a93ba9c528 /src/resolve
parent0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (diff)
downloadsystemd-da927ba997d68401563b927f92e6e40e021a8e5c.tar.gz
systemd-da927ba997d68401563b927f92e6e40e021a8e5c.tar.bz2
systemd-da927ba997d68401563b927f92e6e40e021a8e5c.zip
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-bus.c20
-rw-r--r--src/resolve/resolved-dns-scope.c20
-rw-r--r--src/resolve/resolved-dns-zone.c2
-rw-r--r--src/resolve/resolved-link.c16
-rw-r--r--src/resolve/resolved-manager.c12
-rw-r--r--src/resolve/resolved.c16
6 files changed, 43 insertions, 43 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 517d20eca9..c6b5915853 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -251,7 +251,7 @@ static void bus_method_resolve_hostname_complete(DnsQuery *q) {
finish:
if (r < 0) {
- log_error_errno(-r, "Failed to send hostname reply: %m");
+ log_error_errno(r, "Failed to send hostname reply: %m");
sd_bus_reply_method_errno(q->request, -r, NULL);
}
@@ -419,7 +419,7 @@ static void bus_method_resolve_address_complete(DnsQuery *q) {
finish:
if (r < 0) {
- log_error_errno(-r, "Failed to send address reply: %m");
+ log_error_errno(r, "Failed to send address reply: %m");
sd_bus_reply_method_errno(q->request, -r, NULL);
}
@@ -591,7 +591,7 @@ static void bus_method_resolve_record_complete(DnsQuery *q) {
finish:
if (r < 0) {
- log_error_errno(-r, "Failed to send record reply: %m");
+ log_error_errno(r, "Failed to send record reply: %m");
sd_bus_reply_method_errno(q->request, -r, NULL);
}
@@ -690,7 +690,7 @@ static int match_prepare_for_sleep(sd_bus *bus, sd_bus_message *message, void *u
r = sd_bus_message_read(message, "b", &b);
if (r < 0) {
- log_debug_errno(-r, "Failed to parse PrepareForSleep signal: %m");
+ log_debug_errno(r, "Failed to parse PrepareForSleep signal: %m");
return 0;
}
@@ -717,11 +717,11 @@ int manager_connect_bus(Manager *m) {
* boot. Let's try in 5s again. As soon as we have
* kdbus we can stop doing this... */
- log_debug_errno(-r, "Failed to connect to bus, trying again in 5s: %m");
+ log_debug_errno(r, "Failed to connect to bus, trying again in 5s: %m");
r = sd_event_add_time(m->event, &m->bus_retry_event_source, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + 5*USEC_PER_SEC, 0, on_bus_retry, m);
if (r < 0) {
- log_error_errno(-r, "Failed to install bus reconnect time event: %m");
+ log_error_errno(r, "Failed to install bus reconnect time event: %m");
return r;
}
@@ -730,19 +730,19 @@ int manager_connect_bus(Manager *m) {
r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/resolve1", "org.freedesktop.resolve1.Manager", resolve_vtable, m);
if (r < 0) {
- log_error_errno(-r, "Failed to register object: %m");
+ log_error_errno(r, "Failed to register object: %m");
return r;
}
r = sd_bus_request_name(m->bus, "org.freedesktop.resolve1", 0);
if (r < 0) {
- log_error_errno(-r, "Failed to register name: %m");
+ log_error_errno(r, "Failed to register name: %m");
return r;
}
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0) {
- log_error_errno(-r, "Failed to attach bus to event loop: %m");
+ log_error_errno(r, "Failed to attach bus to event loop: %m");
return r;
}
@@ -755,7 +755,7 @@ int manager_connect_bus(Manager *m) {
match_prepare_for_sleep,
m);
if (r < 0)
- log_error_errno(-r, "Failed to add match for PrepareForSleep: %m");
+ log_error_errno(r, "Failed to add match for PrepareForSleep: %m");
return 0;
}
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index a31e7929b7..a3631f08a8 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -539,7 +539,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) {
r = dns_packet_extract(p);
if (r < 0) {
- log_debug_errno(-r, "Failed to extract resources from incoming packet: %m");
+ log_debug_errno(r, "Failed to extract resources from incoming packet: %m");
return;
}
@@ -551,7 +551,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) {
r = dns_zone_lookup(&s->zone, p->question, &answer, &soa, &tentative);
if (r < 0) {
- log_debug_errno(-r, "Failed to lookup key: %m");
+ log_debug_errno(r, "Failed to lookup key: %m");
return;
}
if (r == 0)
@@ -562,7 +562,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) {
r = dns_scope_make_reply_packet(s, DNS_PACKET_ID(p), DNS_RCODE_SUCCESS, p->question, answer, soa, tentative, &reply);
if (r < 0) {
- log_debug_errno(-r, "Failed to build reply packet: %m");
+ log_debug_errno(r, "Failed to build reply packet: %m");
return;
}
@@ -581,7 +581,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) {
return;
}
if (fd < 0) {
- log_debug_errno(-fd, "Failed to get reply socket: %m");
+ log_debug_errno(fd, "Failed to get reply socket: %m");
return;
}
@@ -594,7 +594,7 @@ void dns_scope_process_query(DnsScope *s, DnsStream *stream, DnsPacket *p) {
}
if (r < 0) {
- log_debug_errno(-r, "Failed to send reply packet: %m");
+ log_debug_errno(r, "Failed to send reply packet: %m");
return;
}
}
@@ -688,13 +688,13 @@ static int on_conflict_dispatch(sd_event_source *es, usec_t usec, void *userdata
r = dns_scope_make_conflict_packet(scope, rr, &p);
if (r < 0) {
- log_error_errno(-r, "Failed to make conflict packet: %m");
+ log_error_errno(r, "Failed to make conflict packet: %m");
return 0;
}
r = dns_scope_emit(scope, p);
if (r < 0)
- log_debug_errno(-r, "Failed to send conflict packet: %m");
+ log_debug_errno(r, "Failed to send conflict packet: %m");
}
return 0;
@@ -722,7 +722,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) {
if (r == -EEXIST || r == 0)
return 0;
if (r < 0) {
- log_debug_errno(-r, "Failed to queue conflicting RR: %m");
+ log_debug_errno(r, "Failed to queue conflicting RR: %m");
return r;
}
@@ -741,7 +741,7 @@ int dns_scope_notify_conflict(DnsScope *scope, DnsResourceRecord *rr) {
LLMNR_JITTER_INTERVAL_USEC,
on_conflict_dispatch, scope);
if (r < 0) {
- log_debug_errno(-r, "Failed to add conflict dispatch event: %m");
+ log_debug_errno(r, "Failed to add conflict dispatch event: %m");
return r;
}
@@ -772,7 +772,7 @@ void dns_scope_check_conflicts(DnsScope *scope, DnsPacket *p) {
r = dns_packet_extract(p);
if (r < 0) {
- log_debug_errno(-r, "Failed to extract packet: %m");
+ log_debug_errno(r, "Failed to extract packet: %m");
return;
}
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c
index c463fe9c41..a4c9b7d7af 100644
--- a/src/resolve/resolved-dns-zone.c
+++ b/src/resolve/resolved-dns-zone.c
@@ -570,7 +570,7 @@ static int dns_zone_item_verify(DnsZoneItem *i) {
i->state = DNS_ZONE_ITEM_VERIFYING;
r = dns_zone_item_probe_start(i);
if (r < 0) {
- log_error_errno(-r, "Failed to start probing for verifying RR: %m");
+ log_error_errno(r, "Failed to start probing for verifying RR: %m");
i->state = DNS_ZONE_ITEM_ESTABLISHED;
return r;
}
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 2cbc37ceaa..f94e4bb6f0 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -88,7 +88,7 @@ static void link_allocate_scopes(Link *l) {
if (!l->unicast_scope) {
r = dns_scope_new(l->manager, &l->unicast_scope, l, DNS_PROTOCOL_DNS, AF_UNSPEC);
if (r < 0)
- log_warning_errno(-r, "Failed to allocate DNS scope: %m");
+ log_warning_errno(r, "Failed to allocate DNS scope: %m");
}
} else
l->unicast_scope = dns_scope_free(l->unicast_scope);
@@ -99,7 +99,7 @@ static void link_allocate_scopes(Link *l) {
if (!l->llmnr_ipv4_scope) {
r = dns_scope_new(l->manager, &l->llmnr_ipv4_scope, l, DNS_PROTOCOL_LLMNR, AF_INET);
if (r < 0)
- log_warning_errno(-r, "Failed to allocate LLMNR IPv4 scope: %m");
+ log_warning_errno(r, "Failed to allocate LLMNR IPv4 scope: %m");
}
} else
l->llmnr_ipv4_scope = dns_scope_free(l->llmnr_ipv4_scope);
@@ -111,7 +111,7 @@ static void link_allocate_scopes(Link *l) {
if (!l->llmnr_ipv6_scope) {
r = dns_scope_new(l->manager, &l->llmnr_ipv6_scope, l, DNS_PROTOCOL_LLMNR, AF_INET6);
if (r < 0)
- log_warning_errno(-r, "Failed to allocate LLMNR IPv6 scope: %m");
+ log_warning_errno(r, "Failed to allocate LLMNR IPv6 scope: %m");
}
} else
l->llmnr_ipv6_scope = dns_scope_free(l->llmnr_ipv6_scope);
@@ -439,11 +439,11 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) {
r = dns_zone_put(&a->link->llmnr_ipv4_scope->zone, a->link->llmnr_ipv4_scope, a->llmnr_address_rr, true);
if (r < 0)
- log_warning_errno(-r, "Failed to add A record to LLMNR zone: %m");
+ log_warning_errno(r, "Failed to add A record to LLMNR zone: %m");
r = dns_zone_put(&a->link->llmnr_ipv4_scope->zone, a->link->llmnr_ipv4_scope, a->llmnr_ptr_rr, false);
if (r < 0)
- log_warning_errno(-r, "Failed to add IPv6 PTR record to LLMNR zone: %m");
+ log_warning_errno(r, "Failed to add IPv6 PTR record to LLMNR zone: %m");
} else {
if (a->llmnr_address_rr) {
if (a->link->llmnr_ipv4_scope)
@@ -496,11 +496,11 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) {
r = dns_zone_put(&a->link->llmnr_ipv6_scope->zone, a->link->llmnr_ipv6_scope, a->llmnr_address_rr, true);
if (r < 0)
- log_warning_errno(-r, "Failed to add AAAA record to LLMNR zone: %m");
+ log_warning_errno(r, "Failed to add AAAA record to LLMNR zone: %m");
r = dns_zone_put(&a->link->llmnr_ipv6_scope->zone, a->link->llmnr_ipv6_scope, a->llmnr_ptr_rr, false);
if (r < 0)
- log_warning_errno(-r, "Failed to add IPv6 PTR record to LLMNR zone: %m");
+ log_warning_errno(r, "Failed to add IPv6 PTR record to LLMNR zone: %m");
} else {
if (a->llmnr_address_rr) {
if (a->link->llmnr_ipv6_scope)
@@ -519,7 +519,7 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) {
return;
fail:
- log_debug_errno(-r, "Failed to update address RRs: %m");
+ log_debug_errno(r, "Failed to update address RRs: %m");
}
int link_address_update_rtnl(LinkAddress *a, sd_rtnl_message *m) {
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 43031bc458..9f61c9d9a2 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -100,7 +100,7 @@ static int manager_process_link(sd_rtnl *rtnl, sd_rtnl_message *mm, void *userda
return 0;
fail:
- log_warning_errno(-r, "Failed to process RTNL link message: %m");
+ log_warning_errno(r, "Failed to process RTNL link message: %m");
return 0;
}
@@ -185,7 +185,7 @@ static int manager_process_address(sd_rtnl *rtnl, sd_rtnl_message *mm, void *use
return 0;
fail:
- log_warning_errno(-r, "Failed to process RTNL address message: %m");
+ log_warning_errno(r, "Failed to process RTNL address message: %m");
return 0;
}
@@ -278,12 +278,12 @@ static int on_network_event(sd_event_source *s, int fd, uint32_t revents, void *
HASHMAP_FOREACH(l, m->links, i) {
r = link_update_monitor(l);
if (r < 0)
- log_warning_errno(-r, "Failed to update monitor information for %i: %m", l->ifindex);
+ log_warning_errno(r, "Failed to update monitor information for %i: %m", l->ifindex);
}
r = manager_write_resolv_conf(m);
if (r < 0)
- log_warning_errno(-r, "Could not update resolv.conf: %m");
+ log_warning_errno(r, "Could not update resolv.conf: %m");
return 0;
}
@@ -380,7 +380,7 @@ static int manager_watch_hostname(Manager *m) {
/* kernels prior to 3.2 don't support polling this file. Ignore the failure. */
m->hostname_fd = safe_close(m->hostname_fd);
else {
- log_error_errno(-r, "Failed to add hostname event source: %m");
+ log_error_errno(r, "Failed to add hostname event source: %m");
return r;
}
}
@@ -688,7 +688,7 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) {
r = in_addr_to_string(s->family, &s->address, &t);
if (r < 0) {
- log_warning_errno(-r, "Invalid DNS address. Ignoring: %m");
+ log_warning_errno(r, "Invalid DNS address. Ignoring: %m");
return;
}
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index 9150a5e33b..c0ab947c0e 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -49,20 +49,20 @@ int main(int argc, char *argv[]) {
r = mac_selinux_init(NULL);
if (r < 0) {
- log_error_errno(-r, "SELinux setup failed: %m");
+ log_error_errno(r, "SELinux setup failed: %m");
goto finish;
}
r = get_user_creds(&user, &uid, &gid, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Cannot resolve user name %s: %m", user);
+ log_error_errno(r, "Cannot resolve user name %s: %m", user);
goto finish;
}
/* Always create the directory where resolv.conf will live */
r = mkdir_safe_label("/run/systemd/resolve", 0755, uid, gid);
if (r < 0) {
- log_error_errno(-r, "Could not create runtime directory: %m");
+ log_error_errno(r, "Could not create runtime directory: %m");
goto finish;
}
@@ -74,17 +74,17 @@ int main(int argc, char *argv[]) {
r = manager_new(&m);
if (r < 0) {
- log_error_errno(-r, "Could not create manager: %m");
+ log_error_errno(r, "Could not create manager: %m");
goto finish;
}
r = manager_parse_config_file(m);
if (r < 0)
- log_warning_errno(-r, "Failed to parse configuration file: %m");
+ log_warning_errno(r, "Failed to parse configuration file: %m");
r = manager_start(m);
if (r < 0) {
- log_error_errno(-r, "Failed to start manager: %m");
+ log_error_errno(r, "Failed to start manager: %m");
goto finish;
}
@@ -92,7 +92,7 @@ int main(int argc, char *argv[]) {
* symlink */
r = manager_write_resolv_conf(m);
if (r < 0)
- log_warning_errno(-r, "Could not create resolv.conf: %m");
+ log_warning_errno(r, "Could not create resolv.conf: %m");
sd_notify(false,
"READY=1\n"
@@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
r = sd_event_loop(m->event);
if (r < 0) {
- log_error_errno(-r, "Event loop failed: %m");
+ log_error_errno(r, "Event loop failed: %m");
goto finish;
}