summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 96ba2bd11e..8dd82ec2ac 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1983,6 +1983,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
uint64_t p, l;
le64_t le_hash;
size_t t;
+ int compression;
p = le64toh(o->entry.items[i].object_offset);
le_hash = o->entry.items[i].hash;
@@ -1995,17 +1996,19 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
l = le64toh(o->object.size) - offsetof(Object, data.payload);
- if ((o->object.flags & OBJECT_COMPRESSION_MASK) &&
- decompress_startswith(o->object.flags & OBJECT_COMPRESSION_MASK,
+ compression = o->object.flags & OBJECT_COMPRESSION_MASK;
+ if (compression &&
+ decompress_startswith(compression,
o->data.payload, l,
&f->compress_buffer, &f->compress_buffer_size,
field, field_length, '=')) {
uint64_t rsize;
- r = decompress_blob_xz(o->data.payload, l,
- &f->compress_buffer, &f->compress_buffer_size, &rsize,
- j->data_threshold);
+ r = decompress_blob(compression,
+ o->data.payload, l,
+ &f->compress_buffer, &f->compress_buffer_size, &rsize,
+ j->data_threshold);
if (r < 0)
return r;
@@ -2040,6 +2043,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **data, size_t *size) {
size_t t;
uint64_t l;
+ int compression, r;
l = le64toh(o->object.size) - offsetof(Object, data.payload);
t = (size_t) l;
@@ -2048,18 +2052,18 @@ static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **da
if ((uint64_t) t != l)
return -E2BIG;
- if (o->object.flags & OBJECT_COMPRESSED_XZ) {
-#ifdef HAVE_XZ
+ compression = o->object.flags & OBJECT_COMPRESSION_MASK;
+ if (compression) {
uint64_t rsize;
- if (!decompress_blob_xz(o->data.payload, l, &f->compress_buffer, &f->compress_buffer_size, &rsize, j->data_threshold))
- return -EBADMSG;
+ r = decompress_blob(compression,
+ o->data.payload, l, &f->compress_buffer,
+ &f->compress_buffer_size, &rsize, j->data_threshold);
+ if (r < 0)
+ return r;
*data = f->compress_buffer;
*size = (size_t) rsize;
-#else
- return -EPROTONOSUPPORT;
-#endif
} else {
*data = o->data.payload;
*size = t;