diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:29:59 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:49:27 +0100 |
commit | 56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch) | |
tree | 4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/core/killall.c | |
parent | 895b3a7b44fe7ca2f260986be2a877ff56a72718 (diff) |
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'
Plus some whitespace, linewrap, and indent adjustments.
Diffstat (limited to 'src/core/killall.c')
-rw-r--r-- | src/core/killall.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/killall.c b/src/core/killall.c index a6ff50a5a4..5a50ae6f04 100644 --- a/src/core/killall.c +++ b/src/core/killall.c @@ -102,7 +102,7 @@ static void wait_for_children(Set *pids, sigset_t *mask) { if (errno == ECHILD) break; - log_error("waitpid() failed: %m"); + log_error_errno(errno, "waitpid() failed: %m"); return; } @@ -136,7 +136,7 @@ static void wait_for_children(Set *pids, sigset_t *mask) { if (k != SIGCHLD) { if (k < 0 && errno != EAGAIN) { - log_error("sigtimedwait() failed: %m"); + log_error_errno(errno, "sigtimedwait() failed: %m"); return; } @@ -178,7 +178,7 @@ static int killall(int sig, Set *pids, bool send_sighup) { if (pids) set_put(pids, ULONG_TO_PTR(pid)); } else if (errno != ENOENT) - log_warning("Could not kill %d: %m", pid); + log_warning_errno(errno, "Could not kill %d: %m", pid); if (send_sighup) { /* Optionally, also send a SIGHUP signal, but @@ -212,12 +212,12 @@ void broadcast_signal(int sig, bool wait_for_exit, bool send_sighup) { assert_se(sigprocmask(SIG_BLOCK, &mask, &oldmask) == 0); if (kill(-1, SIGSTOP) < 0 && errno != ESRCH) - log_warning("kill(-1, SIGSTOP) failed: %m"); + log_warning_errno(errno, "kill(-1, SIGSTOP) failed: %m"); killall(sig, pids, send_sighup); if (kill(-1, SIGCONT) < 0 && errno != ESRCH) - log_warning("kill(-1, SIGCONT) failed: %m"); + log_warning_errno(errno, "kill(-1, SIGCONT) failed: %m"); if (wait_for_exit) wait_for_children(pids, &mask); |