mirror of
https://github.com/systemd/systemd.git
synced 2024-11-28 12:53:36 +08:00
Merge pull request #3124 from poettering/small-journal-fixes
This commit is contained in:
commit
a109d2e204
@ -94,11 +94,10 @@
|
|||||||
required to access <filename>/tmp</filename> and
|
required to access <filename>/tmp</filename> and
|
||||||
<filename>/var/tmp</filename>.</para>
|
<filename>/var/tmp</filename>.</para>
|
||||||
|
|
||||||
<para>Units whose output standard output or error output is
|
<para>Units whose output standard output or error output is connected to <option>journal</option>,
|
||||||
connected to any other sink but <option>null</option>,
|
<option>syslog</option> or <option>kmsg</option> (or their combinations with console output, see below)
|
||||||
<option>tty</option> and <option>socket</option> automatically
|
automatically acquire dependencies of type <varname>After=</varname> on
|
||||||
acquire dependencies of type <varname>After=</varname> on
|
<filename>systemd-journald.socket</filename>.</para>
|
||||||
<filename>journald.socket</filename>.</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@ -470,6 +469,10 @@
|
|||||||
similar to the same option of
|
similar to the same option of
|
||||||
<varname>StandardInput=</varname>.</para>
|
<varname>StandardInput=</varname>.</para>
|
||||||
|
|
||||||
|
<para>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 <varname>After=</varname> on
|
||||||
|
<filename>systemd-journald.socket</filename> (also see the automatic dependencies section above).</para>
|
||||||
|
|
||||||
<para>This setting defaults to the value set with
|
<para>This setting defaults to the value set with
|
||||||
<option>DefaultStandardOutput=</option> in
|
<option>DefaultStandardOutput=</option> in
|
||||||
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||||
|
@ -707,7 +707,11 @@ int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset
|
|||||||
|
|
||||||
/* Objects may only be located at multiple of 64 bit */
|
/* Objects may only be located at multiple of 64 bit */
|
||||||
if (!VALID64(offset))
|
if (!VALID64(offset))
|
||||||
return -EFAULT;
|
return -EBADMSG;
|
||||||
|
|
||||||
|
/* Object may not be located in the file header */
|
||||||
|
if (offset < le64toh(f->header->header_size))
|
||||||
|
return -EBADMSG;
|
||||||
|
|
||||||
r = journal_file_move_to(f, type, false, offset, sizeof(ObjectHeader), &t);
|
r = journal_file_move_to(f, type, false, offset, sizeof(ObjectHeader), &t);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@ -1980,9 +1984,14 @@ static int generic_array_bisect(
|
|||||||
i = right - 1;
|
i = right - 1;
|
||||||
lp = p = le64toh(array->entry_array.items[i]);
|
lp = p = le64toh(array->entry_array.items[i]);
|
||||||
if (p <= 0)
|
if (p <= 0)
|
||||||
return -EBADMSG;
|
r = -EBADMSG;
|
||||||
|
else
|
||||||
r = test_object(f, p, needle);
|
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;
|
||||||
|
}
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -2058,9 +2067,14 @@ static int generic_array_bisect(
|
|||||||
|
|
||||||
p = le64toh(array->entry_array.items[i]);
|
p = le64toh(array->entry_array.items[i]);
|
||||||
if (p <= 0)
|
if (p <= 0)
|
||||||
return -EBADMSG;
|
r = -EBADMSG;
|
||||||
|
else
|
||||||
r = test_object(f, p, needle);
|
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;
|
||||||
|
}
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -2465,12 +2479,18 @@ int journal_file_next_entry(
|
|||||||
le64toh(f->header->entry_array_offset),
|
le64toh(f->header->entry_array_offset),
|
||||||
i,
|
i,
|
||||||
ret, &ofs);
|
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)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (p > 0 &&
|
if (p > 0 &&
|
||||||
(direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) {
|
(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;
|
return -EBADMSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,10 @@ static int output_short(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
if (r == -EBADMSG) {
|
||||||
|
log_debug_errno(r, "Skipping message we can't read: %m");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to get journal fields: %m");
|
return log_error_errno(r, "Failed to get journal fields: %m");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user