summaryrefslogtreecommitdiff
path: root/src/core/shutdown.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 11:58:34 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 12:04:41 +0100
commit0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch)
tree50117277be2e2078d0373b944a30b4f09bb94443 /src/core/shutdown.c
parentb4d23205f238e06aaa31264628e20669e714acad (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/shutdown.c')
-rw-r--r--src/core/shutdown.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 121998ff5..53c701a8f 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -240,7 +240,7 @@ int main(int argc, char *argv[]) {
} else if (r > 0)
log_info("Not all file systems unmounted, %d left.", r);
else
- log_error("Failed to unmount file systems: %s", strerror(-r));
+ log_error_errno(-r, "Failed to unmount file systems: %m");
}
if (need_swapoff) {
@@ -252,7 +252,7 @@ int main(int argc, char *argv[]) {
} else if (r > 0)
log_info("Not all swaps deactivated, %d left.", r);
else
- log_error("Failed to deactivate swaps: %s", strerror(-r));
+ log_error_errno(-r, "Failed to deactivate swaps: %m");
}
if (need_loop_detach) {
@@ -264,7 +264,7 @@ int main(int argc, char *argv[]) {
} else if (r > 0)
log_info("Not all loop devices detached, %d left.", r);
else
- log_error("Failed to detach loop devices: %s", strerror(-r));
+ log_error_errno(-r, "Failed to detach loop devices: %m");
}
if (need_dm_detach) {
@@ -276,7 +276,7 @@ int main(int argc, char *argv[]) {
} else if (r > 0)
log_info("Not all DM devices detached, %d left.", r);
else
- log_error("Failed to detach DM devices: %s", strerror(-r));
+ log_error_errno(-r, "Failed to detach DM devices: %m");
}
if (!need_umount && !need_swapoff && !need_loop_detach && !need_dm_detach) {
@@ -329,7 +329,7 @@ int main(int argc, char *argv[]) {
execv("/shutdown", argv);
log_error("Failed to execute shutdown binary: %m");
} else
- log_error("Failed to switch root to \"/run/initramfs\": %s", strerror(-r));
+ log_error_errno(-r, "Failed to switch root to \"/run/initramfs\": %m");
}
@@ -416,7 +416,7 @@ int main(int argc, char *argv[]) {
r = -errno;
error:
- log_emergency("Critical error while doing system shutdown: %s", strerror(-r));
+ log_emergency_errno(-r, "Critical error while doing system shutdown: %m");
freeze();
}