From 56f64d95763a799ba4475daf44d8e9f72a1bd474 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Fri, 28 Nov 2014 19:29:59 +0100 Subject: 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. --- src/core/shutdown.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/shutdown.c') 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: -- cgit v1.2.3-54-g00ecf