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-manager.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-manager.c')
-rw-r--r-- | src/resolve/resolved-manager.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index c4a5b08773..43031bc458 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("Failed to process RTNL link message: %s", strerror(-r)); + 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("Failed to process RTNL address message: %s", strerror(-r)); + 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("Failed to update monitor information for %i: %s", l->ifindex, strerror(-r)); + 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("Could not update resolv.conf: %s", strerror(-r)); + 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("Failed to add hostname event source: %s", strerror(-r)); + 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("Invalid DNS address. Ignoring: %s", strerror(-r)); + log_warning_errno(-r, "Invalid DNS address. Ignoring: %m"); return; } |