summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2021-09-15 13:05:46 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-10-12 17:59:21 +0200
commitfba060a7d2e2cd3014627c155b38c856cf8a4a3b (patch)
treed25ee8c32ab7edb132485d6663a4df5640c168aa
parent44cea384e5788a2dd4ea8197927be658f89f8877 (diff)
downloadsystemd-fba060a7d2e2cd3014627c155b38c856cf8a4a3b.tar.gz
sd-journal: Ignore data threshold if set to zero in sd_journal_enumerate_fields()
According to the documentation, Setting the data threshold to zero disables the data threshold alltogether. Let's make sure we actually implement this behaviour in sd_journal_enumerate_fields() by only applying the data threshold if it exceeds zero. (cherry picked from commit adbd80f51088058d55e703abe0ac11476cfe0ba4) (cherry picked from commit 99ae9b83b42abbe54c059ae964b737b64ae17df9)
-rw-r--r--src/libsystemd/sd-journal/sd-journal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
index d3bc40507d..ae1d8c5eff 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -3158,7 +3158,7 @@ _public_ int sd_journal_enumerate_fields(sd_journal *j, const char **field) {
if (memchr(o->field.payload, 0, sz))
return -EBADMSG;
- if (sz > j->data_threshold)
+ if (j->data_threshold > 0 && sz > j->data_threshold)
sz = j->data_threshold;
if (!GREEDY_REALLOC(j->fields_buffer, j->fields_buffer_allocated, sz + 1))