summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-07 18:31:10 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-07 18:36:55 -0400
commit1ec7120e50bc084342f8c44aea771c79aaeb774d (patch)
treec7463592924d6542756a2b19f918b2f2d2677542 /src/journal/sd-journal.c
parentc92e531c82a9815ec349aa1bf31236b86b2d5311 (diff)
journal/compress: fix calls to decompress_blob
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;