sd-journal: Ignore data threshold if set to zero in sd_journal_enumerate_fields()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Sep 2021 12:05:46 +0000 (13:05 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Oct 2021 15:01:50 +0000 (17:01 +0200)
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)

src/libsystemd/sd-journal/sd-journal.c

index a2fbc1b0373da4cfb3b841a7bfbe7e7b4afd5f66..b3240177cb406a1a3d2ec05f30b9d4969d234825 100644 (file)
@@ -3178,7 +3178,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, sz + 1))