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.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index ca805f83fe..96ba2bd11e 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1995,28 +1995,24 @@ _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_COMPRESSED) {
+ if ((o->object.flags & OBJECT_COMPRESSION_MASK) &&
+ decompress_startswith(o->object.flags & OBJECT_COMPRESSION_MASK,
+ o->data.payload, l,
+ &f->compress_buffer, &f->compress_buffer_size,
+ field, field_length, '=')) {
-#ifdef HAVE_XZ
- if (uncompress_startswith(o->data.payload, l,
- &f->compress_buffer, &f->compress_buffer_size,
- field, field_length, '=')) {
-
- uint64_t rsize;
+ uint64_t rsize;
- if (!uncompress_blob(o->data.payload, l,
- &f->compress_buffer, &f->compress_buffer_size, &rsize,
- j->data_threshold))
- return -EBADMSG;
+ r = decompress_blob_xz(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;
+ *data = f->compress_buffer;
+ *size = (size_t) rsize;
- return 0;
- }
-#else
- return -EPROTONOSUPPORT;
-#endif
+ return 0;
} else if (l >= field_length+1 &&
memcmp(o->data.payload, field, field_length) == 0 &&
@@ -2052,11 +2048,11 @@ 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) {
+ if (o->object.flags & OBJECT_COMPRESSED_XZ) {
#ifdef HAVE_XZ
uint64_t rsize;
- if (!uncompress_blob(o->data.payload, l, &f->compress_buffer, &f->compress_buffer_size, &rsize, j->data_threshold))
+ if (!decompress_blob_xz(o->data.payload, l, &f->compress_buffer, &f->compress_buffer_size, &rsize, j->data_threshold))
return -EBADMSG;
*data = f->compress_buffer;