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/core/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/core/manager.c')
-rw-r--r-- | src/core/manager.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 164676126f..94e347ef20 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -303,7 +303,7 @@ static int manager_watch_idle_pipe(Manager *m) { r = sd_event_add_io(m->event, &m->idle_pipe_event_source, m->idle_pipe[2], EPOLLIN, manager_dispatch_idle_pipe_fd, m); if (r < 0) { - log_error("Failed to watch idle pipe: %s", strerror(-r)); + log_error_errno(-r, "Failed to watch idle pipe: %m"); return r; } @@ -349,7 +349,7 @@ static int manager_setup_time_change(Manager *m) { r = sd_event_add_io(m->event, &m->time_change_event_source, m->time_change_fd, EPOLLIN, manager_dispatch_time_change_fd, m); if (r < 0) { - log_error("Failed to create time change event source: %s", strerror(-r)); + log_error_errno(-r, "Failed to create time change event source: %m"); return r; } @@ -697,7 +697,7 @@ static int manager_setup_notify(Manager *m) { if (!m->notify_event_source) { r = sd_event_add_io(m->event, &m->notify_event_source, m->notify_fd, EPOLLIN, manager_dispatch_notify_fd, m); if (r < 0) { - log_error("Failed to allocate notify event source: %s", strerror(-r)); + log_error_errno(-r, "Failed to allocate notify event source: %m"); return -errno; } @@ -705,7 +705,7 @@ static int manager_setup_notify(Manager *m) { * still identify to which service an exit message belongs */ r = sd_event_source_set_priority(m->notify_event_source, -7); if (r < 0) { - log_error("Failed to set priority of notify event source: %s", strerror(-r)); + log_error_errno(-r, "Failed to set priority of notify event source: %m"); return r; } } @@ -1060,7 +1060,7 @@ static void manager_build_unit_path_cache(Manager *m) { return; fail: - log_error("Failed to build unit path cache: %s", strerror(-r)); + log_error_errno(-r, "Failed to build unit path cache: %m"); set_free_free(m->unit_path_cache); m->unit_path_cache = NULL; @@ -1989,7 +1989,7 @@ int manager_loop(Manager *m) { r = sd_event_run(m->event, wait_usec); if (r < 0) { - log_error("Failed to run event loop: %s", strerror(-r)); + log_error_errno(-r, "Failed to run event loop: %m"); return r; } } |