]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 15 Sep 2021 15:12:25 +0000 (00:12 +0900)
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.

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

index c6694bda95ff0ff615e40c0303c24678f0b50d77..fbd2fb38bbfa33bc0ad4c1780edc48c2045a725f 100644 (file)
@@ -3174,7 +3174,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))