From 0a1beeb64207eaa88ab9236787b1cbc2f704ae14 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Fri, 28 Nov 2014 11:58:34 +0100 Subject: 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(). --- src/fsck/fsck.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/fsck') diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index 556221759a..f5158735fa 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -54,7 +54,7 @@ static void start_target(const char *target) { r = bus_open_system_systemd(&bus); if (r < 0) { - log_error("Failed to get D-Bus connection: %s", strerror(-r)); + log_error_errno(-r, "Failed to get D-Bus connection: %m"); return; } @@ -238,7 +238,7 @@ int main(int argc, char *argv[]) { q = parse_proc_cmdline(parse_proc_cmdline_item); if (q < 0) - log_warning("Failed to parse kernel command line, ignoring: %s", strerror(-q)); + log_warning_errno(-q, "Failed to parse kernel command line, ignoring: %m"); test_files(); @@ -309,7 +309,7 @@ int main(int argc, char *argv[]) { log_info("fsck.%s doesn't exist, not checking file system on %s", type, device); return EXIT_SUCCESS; } else if (r < 0) - log_warning("fsck.%s cannot be used for %s: %s", type, device, strerror(-r)); + log_warning_errno(-r, "fsck.%s cannot be used for %s: %m", type, device); } if (arg_show_progress) @@ -365,7 +365,7 @@ int main(int argc, char *argv[]) { q = wait_for_terminate(pid, &status); if (q < 0) { - log_error("waitid(): %s", strerror(-q)); + log_error_errno(-q, "waitid(): %m"); goto finish; } -- cgit v1.2.3-54-g00ecf