1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

coredumpctl: show a useful error on permission problems

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2014-07-06 18:35:46 -04:00
parent fd53fee04b
commit 31cda3d175

View File

@ -595,7 +595,8 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
retrieve(data, len, "COREDUMP_FILENAME", &filename); retrieve(data, len, "COREDUMP_FILENAME", &filename);
if (filename && access(filename, R_OK) < 0) { 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); free(filename);
filename = NULL; filename = NULL;
} }
@ -668,7 +669,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
#endif #endif
} else { } else {
if (r == -ENOENT) 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 else
log_error("Failed to retrieve COREDUMP field: %s", strerror(-r)); log_error("Failed to retrieve COREDUMP field: %s", strerror(-r));
goto error; goto error;