|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
From 26bffa023b572b25ec8ef6be70b4ed114492a592 Mon Sep 17 00:00:00 2001
|
|
Michal Sekletar |
f5f073 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Michal Sekletar |
f5f073 |
Date: Sun, 5 Mar 2017 10:35:44 -0500
|
|
Michal Sekletar |
f5f073 |
Subject: [PATCH] coredump: fix handling of premature-eof data for --backtrace
|
|
Michal Sekletar |
f5f073 |
|
|
Michal Sekletar |
f5f073 |
We'd fail with an assert in journal_importer_process_data(),
|
|
Michal Sekletar |
f5f073 |
because that function requires the caller to handle EOF themselves.
|
|
Michal Sekletar |
f5f073 |
|
|
Michal Sekletar |
f5f073 |
(cherry picked from commit d74dc4f2d00644c04ad9dc900ef43050fcadaa8b)
|
|
Michal Sekletar |
f5f073 |
---
|
|
Michal Sekletar |
f5f073 |
src/basic/journal-importer.c | 2 +-
|
|
Michal Sekletar |
f5f073 |
src/coredump/coredump.c | 3 ++-
|
|
Michal Sekletar |
f5f073 |
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
Michal Sekletar |
f5f073 |
|
|
Michal Sekletar |
f5f073 |
diff --git a/src/basic/journal-importer.c b/src/basic/journal-importer.c
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
index 4c13e46a49..d25fd358e8 100644
|
|
Michal Sekletar |
f5f073 |
--- a/src/basic/journal-importer.c
|
|
Michal Sekletar |
f5f073 |
+++ b/src/basic/journal-importer.c
|
|
Michal Sekletar |
f5f073 |
@@ -314,7 +314,7 @@ int journal_importer_process_data(JournalImporter *imp) {
|
|
Michal Sekletar |
f5f073 |
return r;
|
|
Michal Sekletar |
f5f073 |
if (r == 0) {
|
|
Michal Sekletar |
f5f073 |
imp->state = IMPORTER_STATE_EOF;
|
|
Michal Sekletar |
f5f073 |
- return r;
|
|
Michal Sekletar |
f5f073 |
+ return 0;
|
|
Michal Sekletar |
f5f073 |
}
|
|
Michal Sekletar |
f5f073 |
assert(n > 0);
|
|
Michal Sekletar |
f5f073 |
assert(line[n-1] == '\n');
|
|
Michal Sekletar |
f5f073 |
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
index 4c4f36aea0..5828e949e3 100644
|
|
Michal Sekletar |
f5f073 |
--- a/src/coredump/coredump.c
|
|
Michal Sekletar |
f5f073 |
+++ b/src/coredump/coredump.c
|
|
Michal Sekletar |
f5f073 |
@@ -1326,7 +1326,8 @@ static int process_backtrace(int argc, char *argv[]) {
|
|
Michal Sekletar |
f5f073 |
log_error_errno(r, "Failed to parse journal entry on stdin: %m");
|
|
Michal Sekletar |
f5f073 |
goto finish;
|
|
Michal Sekletar |
f5f073 |
}
|
|
Michal Sekletar |
f5f073 |
- if (r == 1)
|
|
Michal Sekletar |
f5f073 |
+ if (r == 1 || /* complete entry */
|
|
Michal Sekletar |
f5f073 |
+ journal_importer_eof(&importer)) /* end of data */
|
|
Michal Sekletar |
f5f073 |
break;
|
|
Michal Sekletar |
f5f073 |
}
|
|
Michal Sekletar |
f5f073 |
|