diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 17:09:20 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 17:17:51 +0100 |
commit | c33b329709ebe2755181980a050d02ec7c81ed87 (patch) | |
tree | 39080c428c72c90daddbe1c08d45c181adf1476c /src/core | |
parent | 5567fafbc9d83a1391f23ecdbe698a3c03929370 (diff) |
treewide: more log_*_errno() conversions, multiline calls
Basically:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
local $_=<>;
s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \
$f; done
Plus manual indentation fixups.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/loopback-setup.c | 6 | ||||
-rw-r--r-- | src/core/main.c | 4 | ||||
-rw-r--r-- | src/core/manager.c | 10 | ||||
-rw-r--r-- | src/core/path.c | 3 |
4 files changed, 9 insertions, 14 deletions
diff --git a/src/core/loopback-setup.c b/src/core/loopback-setup.c index 6ac1fffd75..ca8ac4ea61 100644 --- a/src/core/loopback-setup.c +++ b/src/core/loopback-setup.c @@ -93,13 +93,11 @@ int loopback_setup(void) { r = start_loopback(rtnl); if (r == -EPERM) { if (check_loopback() < 0) { - log_warning("Failed to configure loopback device: %s", - strerror(EPERM)); + log_warning_errno(EPERM, "Failed to configure loopback device: %m"); return -EPERM; } } else if (r < 0) { - log_warning("Failed to configure loopback device: %s", - strerror(-r)); + log_warning_errno(r, "Failed to configure loopback device: %m"); return r; } diff --git a/src/core/main.c b/src/core/main.c index c204758d43..6224a7ae6b 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1695,7 +1695,7 @@ int main(int argc, char *argv[]) { if (r < 0) log_error("Failed to load default target: %s", bus_error_message(&error, r)); else if (target->load_state == UNIT_ERROR || target->load_state == UNIT_NOT_FOUND) - log_error("Failed to load default target: %s", strerror(-target->load_error)); + log_error_errno(target->load_error, "Failed to load default target: %m"); else if (target->load_state == UNIT_MASKED) log_error("Default target masked."); @@ -1708,7 +1708,7 @@ int main(int argc, char *argv[]) { error_message = "Failed to load rescue target"; goto finish; } else if (target->load_state == UNIT_ERROR || target->load_state == UNIT_NOT_FOUND) { - log_emergency("Failed to load rescue target: %s", strerror(-target->load_error)); + log_emergency_errno(target->load_error, "Failed to load rescue target: %m"); error_message = "Failed to load rescue target"; goto finish; } else if (target->load_state == UNIT_MASKED) { diff --git a/src/core/manager.c b/src/core/manager.c index ef58bdd161..c56c1621b0 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -238,7 +238,7 @@ static int manager_dispatch_ask_password_fd(sd_event_source *source, if (m->have_ask_password < 0) /* Log error but continue. Negative have_ask_password * is treated as unknown status. */ - log_error("Failed to list /run/systemd/ask-password: %s", strerror(m->have_ask_password)); + log_error_errno(m->have_ask_password, "Failed to list /run/systemd/ask-password: %m"); return 0; } @@ -730,7 +730,7 @@ static int manager_setup_kdbus(Manager *m) { m->running_as == SYSTEMD_SYSTEM, &p); if (m->kdbus_fd < 0) { - log_debug("Failed to set up kdbus: %s", strerror(-m->kdbus_fd)); + log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m"); return m->kdbus_fd; } @@ -2699,8 +2699,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name) r = mkdir_p_label(p, 0755); if (r < 0) { - log_error("Failed to create generator directory %s: %s", - p, strerror(-r)); + log_error_errno(r, "Failed to create generator directory %s: %m", p); free(p); return r; } @@ -2716,8 +2715,7 @@ static int create_generator_dir(Manager *m, char **generator, const char *name) r = mkdir_p_label(p, 0755); if (r < 0) { - log_error("Failed to create generator directory %s: %s", - p, strerror(-r)); + log_error_errno(r, "Failed to create generator directory %s: %m", p); free(p); return r; } diff --git a/src/core/path.c b/src/core/path.c index ca586d9616..202cba5d31 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -562,8 +562,7 @@ static void path_enter_waiting(Path *p, bool initial, bool recheck) { return; fail: - log_warning("%s failed to enter waiting state: %s", - UNIT(p)->id, strerror(-r)); + log_warning_errno(r, "%s failed to enter waiting state: %m", UNIT(p)->id); path_enter_dead(p, PATH_FAILURE_RESOURCES); } |