]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredump: fix handling of premature-eof data for --backtrace 5540/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 5 Mar 2017 15:35:44 +0000 (10:35 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 5 Mar 2017 15:35:44 +0000 (10:35 -0500)
We'd fail with an assert in journal_importer_process_data(),
because that function requires the caller to handle EOF themselves.

src/basic/journal-importer.c
src/coredump/coredump.c

index 4c13e46a49e986d5d93b79b9b6750e9218b295a0..d25fd358e8594ce1c127208dbd8bbb78fa88cad0 100644 (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');
index 4c4f36aea097612a8a0937e72fd125df66e5ca20..5828e949e3d48888459c0acb79d0d8002e1b800d 100644 (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;
         }