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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-03-05 10:35:44 -05:00
parent bf1c790c8f
commit d74dc4f2d0
2 changed files with 3 additions and 2 deletions

View file

@ -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');

View file

@ -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;
}