systemd-coredump: Log crashes without coredumps on failure

Make a best-effort attempt to store information about crashes during
failure, currently if these are encountered the crash is completely
silenced.

ideally coredumpctl would show if a coredump is available.
This commit is contained in:
Andrew Cook
2013-09-04 23:27:52 +10:00
committed by Harald Hoyer
parent ca0ceb6f3e
commit 92f2ff4415

View File

@@ -241,7 +241,7 @@ int main(int argc, char* argv[]) {
coredump_data = malloc(coredump_bufsize);
if (!coredump_data) {
r = log_oom();
goto finish;
goto finalize;
}
memcpy(coredump_data, "COREDUMP=", 9);
@@ -261,12 +261,12 @@ int main(int argc, char* argv[]) {
if(coredump_size > COREDUMP_MAX) {
log_error("Coredump too large, ignoring");
goto finish;
goto finalize;
}
if (!GREEDY_REALLOC(coredump_data, coredump_bufsize, coredump_size + 1)) {
r = log_oom();
goto finish;
goto finalize;
}
}
@@ -274,6 +274,7 @@ int main(int argc, char* argv[]) {
iovec[j].iov_len = coredump_size;
j++;
finalize:
r = sd_journal_sendv(iovec, j);
if (r < 0)
log_error("Failed to send coredump: %s", strerror(-r));