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/shutdown.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/shutdown.c')
-rw-r--r-- | src/core/shutdown.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/shutdown.c b/src/core/shutdown.c index 923cd3b16c..10455fa309 100644 --- a/src/core/shutdown.c +++ b/src/core/shutdown.c @@ -139,12 +139,12 @@ static int parse_argv(int argc, char *argv[]) { static int switch_root_initramfs(void) { if (mount("/run/initramfs", "/run/initramfs", NULL, MS_BIND, NULL) < 0) { - log_error("Failed to mount bind /run/initramfs on /run/initramfs: %m"); + log_error_errno(errno, "Failed to mount bind /run/initramfs on /run/initramfs: %m"); return -errno; } if (mount(NULL, "/run/initramfs", NULL, MS_PRIVATE, NULL) < 0) { - log_error("Failed to make /run/initramfs private mount: %m"); + log_error_errno(errno, "Failed to make /run/initramfs private mount: %m"); return -errno; } @@ -327,7 +327,7 @@ int main(int argc, char *argv[]) { "Returning to initrd..."); execv("/shutdown", argv); - log_error("Failed to execute shutdown binary: %m"); + log_error_errno(errno, "Failed to execute shutdown binary: %m"); } else log_error_errno(r, "Failed to switch root to \"/run/initramfs\": %m"); @@ -359,7 +359,7 @@ int main(int argc, char *argv[]) { pid = fork(); if (pid < 0) - log_error("Failed to fork: %m"); + log_error_errno(errno, "Failed to fork: %m"); else if (pid == 0) { const char * const args[] = { @@ -412,7 +412,7 @@ int main(int argc, char *argv[]) { exit(0); } - log_error("Failed to invoke reboot(): %m"); + log_error_errno(errno, "Failed to invoke reboot(): %m"); r = -errno; error: |