summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-11 10:42:06 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-11 10:42:27 -0400
commit3b1a55e110ab387a8d213581983e20c0a63d7894 (patch)
tree972b5eca785f511c41d96a3f14b172c5f9180b5f /src/journal/sd-journal.c
parent6017365a1d0c1c78fc34a7da63768ee5df5da511 (diff)
Fix build without any compression enabled
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 8dd82ec2ac..f674abf9d7 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1997,26 +1997,30 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
l = le64toh(o->object.size) - offsetof(Object, data.payload);
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(compression,
- o->data.payload, l,
- &f->compress_buffer, &f->compress_buffer_size, &rsize,
- j->data_threshold);
- if (r < 0)
- return r;
+ if (compression) {
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+ if (decompress_startswith(compression,
+ o->data.payload, l,
+ &f->compress_buffer, &f->compress_buffer_size,
+ field, field_length, '=')) {
+
+ uint64_t rsize;
+
+ 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;
-
- return 0;
+ *data = f->compress_buffer;
+ *size = (size_t) rsize;
+ return 0;
+ }
+#else
+ return -EPROTONOSUPPORT;
+#endif
} else if (l >= field_length+1 &&
memcmp(o->data.payload, field, field_length) == 0 &&
o->data.payload[field_length] == '=') {
@@ -2043,7 +2047,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;
+ int compression;
l = le64toh(o->object.size) - offsetof(Object, data.payload);
t = (size_t) l;
@@ -2054,7 +2058,9 @@ static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **da
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
uint64_t rsize;
+ int r;
r = decompress_blob(compression,
o->data.payload, l, &f->compress_buffer,
@@ -2064,6 +2070,9 @@ static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **da
*data = f->compress_buffer;
*size = (size_t) rsize;
+#else
+ return -EPROTONOSUPPORT;
+#endif
} else {
*data = o->data.payload;
*size = t;