From: Zbigniew Jędrzejewski-Szmek Date: Sun, 5 Mar 2017 15:35:44 +0000 (-0500) Subject: coredump: fix handling of premature-eof data for --backtrace X-Git-Tag: v234~389^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d74dc4f2d00644c04ad9dc900ef43050fcadaa8b;p=thirdparty%2Fsystemd.git coredump: fix handling of premature-eof data for --backtrace We'd fail with an assert in journal_importer_process_data(), because that function requires the caller to handle EOF themselves. --- diff --git a/src/basic/journal-importer.c b/src/basic/journal-importer.c index 4c13e46a49e..d25fd358e85 100644 --- a/src/basic/journal-importer.c +++ b/src/basic/journal-importer.c @@ -314,7 +314,7 @@ int journal_importer_process_data(JournalImporter *imp) { return r; if (r == 0) { imp->state = IMPORTER_STATE_EOF; - return r; + return 0; } assert(n > 0); assert(line[n-1] == '\n'); diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 4c4f36aea09..5828e949e3d 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -1326,7 +1326,8 @@ static int process_backtrace(int argc, char *argv[]) { log_error_errno(r, "Failed to parse journal entry on stdin: %m"); goto finish; } - if (r == 1) + if (r == 1 || /* complete entry */ + journal_importer_eof(&importer)) /* end of data */ break; }