diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-30 22:16:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-30 22:26:16 +0200 |
commit | e53fc357a9bb9d0a5362ccc4246d598cb0febd5e (patch) | |
tree | 3bb6c3be9ba053e4a280b6c2ae8cd03be8f1ac6d /src/journal | |
parent | 618234a5258768359cb1086b152c5f08aaf89754 (diff) |
tree-wide: remove a number of invocations of strerror() and replace by %m
Let's clean up our tree a bit, and reduce invocations of the
thread-unsafe strerror() by replacing it with printf()'s %m specifier.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/catalog.c | 11 | ||||
-rw-r--r-- | src/journal/journalctl.c | 2 | ||||
-rw-r--r-- | src/journal/journald-server.c | 3 |
3 files changed, 6 insertions, 10 deletions
diff --git a/src/journal/catalog.c b/src/journal/catalog.c index a3e51e2f52..78ca4b02e8 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -419,8 +419,7 @@ int catalog_update(const char* database, const char* root, const char* const* di log_debug("Reading file '%s'", *f); r = catalog_import_file(h, sb, *f); if (r < 0) { - log_error("Failed to import file '%s': %s.", - *f, strerror(-r)); + log_error_errno(r, "Failed to import file '%s': %m", *f); goto finish; } } @@ -676,8 +675,7 @@ int catalog_list_items(FILE *f, const char *database, bool oneline, char **items k = sd_id128_from_string(*item, &id); if (k < 0) { - log_error_errno(k, "Failed to parse id128 '%s': %m", - *item); + log_error_errno(k, "Failed to parse id128 '%s': %m", *item); if (r == 0) r = k; continue; @@ -685,9 +683,8 @@ int catalog_list_items(FILE *f, const char *database, bool oneline, char **items k = catalog_get(database, id, &msg); if (k < 0) { - log_full(k == -ENOENT ? LOG_NOTICE : LOG_ERR, - "Failed to retrieve catalog entry for '%s': %s", - *item, strerror(-k)); + log_full_errno(k == -ENOENT ? LOG_NOTICE : LOG_ERR, k, + "Failed to retrieve catalog entry for '%s': %m", *item); if (r == 0) r = k; continue; diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 75e59dbd42..ecec854559 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1577,7 +1577,7 @@ static int verify(sd_journal *j) { /* If the key was invalid give up right-away. */ return k; } else if (k < 0) { - log_warning("FAIL: %s (%s)", f->path, strerror(-k)); + log_warning_errno(k, "FAIL: %s (%m)", f->path); r = k; } else { char a[FORMAT_TIMESTAMP_MAX], b[FORMAT_TIMESTAMP_MAX], c[FORMAT_TIMESPAN_MAX]; diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index fa2e9b9825..564a1ae73d 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -1434,8 +1434,7 @@ static int server_open_hostname(Server *s) { /* kernels prior to 3.2 don't support polling this file. Ignore * the failure. */ if (r == -EPERM) { - log_warning("Failed to register hostname fd in event loop: %s. Ignoring.", - strerror(-r)); + log_warning_errno(r, "Failed to register hostname fd in event loop, ignoring: %m"); s->hostname_fd = safe_close(s->hostname_fd); return 0; } |