diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 11:58:34 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 12:04:41 +0100 |
commit | 0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch) | |
tree | 50117277be2e2078d0373b944a30b4f09bb94443 /src/resolve/resolved-bus.c | |
parent | b4d23205f238e06aaa31264628e20669e714acad (diff) |
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'
Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
Diffstat (limited to 'src/resolve/resolved-bus.c')
-rw-r--r-- | src/resolve/resolved-bus.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index 0029023bcc..517d20eca9 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("Failed to send hostname reply: %s", strerror(-r)); + 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("Failed to send address reply: %s", strerror(-r)); + 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("Failed to send record reply: %s", strerror(-r)); + 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("Failed to parse PrepareForSleep signal: %s", strerror(-r)); + 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("Failed to connect to bus, trying again in 5s: %s", strerror(-r)); + 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("Failed to install bus reconnect time event: %s", strerror(-r)); + 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("Failed to register object: %s", strerror(-r)); + 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("Failed to register name: %s", strerror(-r)); + 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("Failed to attach bus to event loop: %s", strerror(-r)); + 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("Failed to add match for PrepareForSleep: %s", strerror(-r)); + log_error_errno(-r, "Failed to add match for PrepareForSleep: %m"); return 0; } |