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