summaryrefslogtreecommitdiff
path: root/src/journal/coredump.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/journal/coredump.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/journal/coredump.c')
-rw-r--r--src/journal/coredump.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index e80b2f7c79..af155b487f 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -313,7 +313,7 @@ static int save_external_coredump(
r = make_filename(info, &fn);
if (r < 0) {
- log_error("Failed to determine coredump file name: %s", strerror(-r));
+ log_error_errno(-r, "Failed to determine coredump file name: %m");
return r;
}
@@ -337,7 +337,7 @@ static int save_external_coredump(
log_error("Not enough disk space for coredump of %s (%s), refusing.", info[INFO_PID], info[INFO_COMM]);
goto fail;
} else if (r < 0) {
- log_error("Failed to dump coredump to file: %s", strerror(-r));
+ log_error_errno(-r, "Failed to dump coredump to file: %m");
goto fail;
}
@@ -379,7 +379,7 @@ static int save_external_coredump(
r = compress_stream(fd, fd_compressed, -1);
if (r < 0) {
- log_error("Failed to compress %s: %s", tmp_compressed, strerror(-r));
+ log_error_errno(-r, "Failed to compress %s: %m", tmp_compressed);
goto fail_compressed;
}
@@ -446,7 +446,7 @@ static int allocate_journal_field(int fd, size_t size, char **ret, size_t *ret_s
n = read(fd, field + 9, size);
if (n < 0) {
- log_error("Failed to read core data: %s", strerror(-n));
+ log_error_errno(-n, "Failed to read core data: %m");
return (int) n;
}
if ((size_t) n < size) {
@@ -841,7 +841,7 @@ int main(int argc, char* argv[]) {
else if (r == -EINVAL)
log_warning("Failed to generate stack trace: %s", dwfl_errmsg(dwfl_errno()));
else
- log_warning("Failed to generate stack trace: %s", strerror(-r));
+ log_warning_errno(-r, "Failed to generate stack trace: %m");
}
if (!core_message)
@@ -868,7 +868,7 @@ log:
r = sd_journal_sendv(iovec, j);
if (r < 0)
- log_error("Failed to log coredump: %s", strerror(-r));
+ log_error_errno(-r, "Failed to log coredump: %m");
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;