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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user