From 34156047f4e34b0d3c621b0641ec3444f2b37f8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 6 Jul 2014 18:35:46 -0400
Subject: [PATCH] coredumpctl: show a useful error on permission problems
(cherry picked from commit 31cda3d1759dee3e48c8ed4a949d99f041bdca1c)
---
src/journal/coredumpctl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 2158d73771..ecde54744d 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -595,7 +595,8 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
retrieve(data, len, "COREDUMP_FILENAME", &filename);
if (filename && access(filename, R_OK) < 0) {
- log_debug("File %s is not readable: %m", filename);
+ log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "File %s is not readable: %m", filename);
free(filename);
filename = NULL;
}
@@ -668,7 +669,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
#endif
} else {
if (r == -ENOENT)
- log_error("Coredump neither in journal file nor stored externally on disk.");
+ log_error("Cannot retrieve coredump from journal nor disk.");
else
log_error("Failed to retrieve COREDUMP field: %s", strerror(-r));
goto error;