diff options
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/compress.c | 4 | ||||
-rw-r--r-- | src/journal/coredump.c | 2 | ||||
-rw-r--r-- | src/journal/journal-file.c | 9 | ||||
-rw-r--r-- | src/journal/sd-journal.c | 47 |
4 files changed, 41 insertions, 21 deletions
diff --git a/src/journal/compress.c b/src/journal/compress.c index 93ac92aaad..316c1a66e3 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -343,6 +343,7 @@ int decompress_startswith(int compression, } int compress_stream_xz(int fdf, int fdt, off_t max_bytes) { +#ifdef HAVE_XZ _cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT; lzma_ret ret; @@ -414,6 +415,9 @@ int compress_stream_xz(int fdf, int fdt, off_t max_bytes) { } } } +#else + return -EPROTONOSUPPORT; +#endif } #define LZ4_BUFSIZE (512*1024) diff --git a/src/journal/coredump.c b/src/journal/coredump.c index 59c6d4b716..1b8c2e8bc0 100644 --- a/src/journal/coredump.c +++ b/src/journal/coredump.c @@ -402,9 +402,9 @@ static int save_external_coredump( fail_compressed: unlink_noerrno(tmp_compressed); } -#endif uncompressed: +#endif r = fix_permissions(fd, tmp, fn, info, uid); if (r < 0) goto fail; diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index d3535d2fad..dc041dd58a 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -819,6 +819,7 @@ int journal_file_find_data_object_with_hash( goto next; if (o->object.flags & OBJECT_COMPRESSION_MASK) { +#if defined(HAVE_XZ) || defined(HAVE_LZ4) uint64_t l, rsize; l = le64toh(o->object.size); @@ -843,7 +844,9 @@ int journal_file_find_data_object_with_hash( return 1; } - +#else + return -EPROTONOSUPPORT; +#endif } else if (le64toh(o->object.size) == osize && memcmp(o->data.payload, data, size) == 0) { @@ -2772,6 +2775,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6 return -E2BIG; if (o->object.flags & OBJECT_COMPRESSION_MASK) { +#if defined(HAVE_XZ) || defined(HAVE_LZ4) uint64_t rsize; r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK, @@ -2781,6 +2785,9 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6 data = from->compress_buffer; l = rsize; +#else + return -EPROTONOSUPPORT; +#endif } else data = o->data.payload; 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; |