From 25eb92e14f2bcc7743f64230d52c75e9f864d5f5 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 26 Apr 2016 09:52:30 -0400 Subject: Revert "smaller journal fixes (#3124)" This reverts commit 6e3930c40f3379b7123e505a71ba4cd6db6c372f. Merge got squashed by mistake. --- man/systemd.exec.xml | 13 +++++-------- src/journal/journal-file.c | 36 ++++++++---------------------------- src/shared/logs-show.c | 5 +---- 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index fea42ebd31..4ed62dbada 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -94,10 +94,11 @@ required to access /tmp and /var/tmp. - Units whose output standard output or error output is connected to , - or (or their combinations with console output, see below) - automatically acquire dependencies of type After= on - systemd-journald.socket. + Units whose output standard output or error output is + connected to any other sink but , + and automatically + acquire dependencies of type After= on + journald.socket. @@ -469,10 +470,6 @@ similar to the same option of StandardInput=. - If the standard output (or error output, see below) of a unit is connected with the journal, syslog or - the kernel log buffer the unit will implicitly gain a dependency of type After= on - systemd-journald.socket (also see the automatic dependencies section above). - This setting defaults to the value set with in systemd-system.conf5, diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index ff01e5aa94..ac6c30f9f2 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -707,11 +707,7 @@ int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset /* Objects may only be located at multiple of 64 bit */ if (!VALID64(offset)) - return -EBADMSG; - - /* Object may not be located in the file header */ - if (offset < le64toh(f->header->header_size)) - return -EBADMSG; + return -EFAULT; r = journal_file_move_to(f, type, false, offset, sizeof(ObjectHeader), &t); if (r < 0) @@ -1984,14 +1980,9 @@ static int generic_array_bisect( i = right - 1; lp = p = le64toh(array->entry_array.items[i]); if (p <= 0) - r = -EBADMSG; - else - r = test_object(f, p, needle); - if (r == -EBADMSG) { - log_debug_errno(r, "Encountered invalid entry while bisecting, cutting algorithm short. (1)"); - n = i; - continue; - } + return -EBADMSG; + + r = test_object(f, p, needle); if (r < 0) return r; @@ -2067,14 +2058,9 @@ static int generic_array_bisect( p = le64toh(array->entry_array.items[i]); if (p <= 0) - r = -EBADMSG; - else - r = test_object(f, p, needle); - if (r == -EBADMSG) { - log_debug_errno(r, "Encountered invalid entry while bisecting, cutting algorithm short. (2)"); - right = n = i; - continue; - } + return -EBADMSG; + + r = test_object(f, p, needle); if (r < 0) return r; @@ -2479,18 +2465,12 @@ int journal_file_next_entry( le64toh(f->header->entry_array_offset), i, ret, &ofs); - if (r == -EBADMSG && direction == DIRECTION_DOWN) { - /* Special case: when we iterate throught the journal file linearly, and hit an entry we can't read, - * consider this the end of the journal file. */ - log_debug_errno(r, "Encountered entry we can't read while iterating through journal file. Considering this the end of the file."); - return 0; - } if (r <= 0) return r; if (p > 0 && (direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) { - log_debug("%s: entry array corrupted at entry %" PRIu64, f->path, i); + log_debug("%s: entry array corrupted at entry %"PRIu64, f->path, i); return -EBADMSG; } diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 9351b85eed..cd3d53669c 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -287,10 +287,7 @@ static int output_short( if (r < 0) return r; } - if (r == -EBADMSG) { - log_debug_errno(r, "Skipping message we can't read: %m"); - return 0; - } + if (r < 0) return log_error_errno(r, "Failed to get journal fields: %m"); -- cgit v1.2.3-54-g00ecf