From 92f2ff4415b43e3265da0a1f09b24635f0874d55 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Wed, 4 Sep 2013 23:27:52 +1000 Subject: 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. --- src/journal/coredump.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/journal/coredump.c b/src/journal/coredump.c index a7d3c34fe4..68c353fe83 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -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)); -- cgit v1.2.3-54-g00ecf