summaryrefslogtreecommitdiff
path: root/src/journal/journal-verify.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/journal-verify.c
parentc92e531c82a9815ec349aa1bf31236b86b2d5311 (diff)
journal/compress: fix calls to decompress_blob
Diffstat (limited to 'src/journal/journal-verify.c')
-rw-r--r--src/journal/journal-verify.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index c063d12210..5a0751f2aa 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -53,6 +53,7 @@ static int journal_file_object_verify(JournalFile *f, uint64_t offset, Object *o
case OBJECT_DATA: {
uint64_t h1, h2;
+ int compression, r;
if (le64toh(o->data.entry_offset) == 0)
log_warning(OFSfmt": unused data (entry_offset==0)", offset);
@@ -72,40 +73,22 @@ static int journal_file_object_verify(JournalFile *f, uint64_t offset, Object *o
h1 = le64toh(o->data.hash);
- if (o->object.flags & OBJECT_COMPRESSED_XZ) {
-#ifdef HAVE_XZ
+ compression = o->object.flags & OBJECT_COMPRESSION_MASK;
+ if (compression) {
_cleanup_free_ void *b = NULL;
uint64_t alloc = 0, b_size;
- if (!decompress_blob_xz(o->data.payload,
- le64toh(o->object.size) - offsetof(Object, data.payload),
- &b, &alloc, &b_size, 0)) {
- log_error(OFSfmt": XZ decompression failed", offset);
- return -EBADMSG;
- }
-
- h2 = hash64(b, b_size);
-#else
- log_error("XZ compression is not supported");
- return -EPROTONOSUPPORT;
-#endif
- } else if (o->object.flags & OBJECT_COMPRESSED_LZ4) {
-#ifdef HAVE_XZ
- _cleanup_free_ void *b = NULL;
- uint64_t alloc = 0, b_size;
-
- if (!decompress_blob_xz(o->data.payload,
- le64toh(o->object.size) - offsetof(Object, data.payload),
- &b, &alloc, &b_size, 0)) {
- log_error(OFSfmt": LZ4 decompression failed", offset);
- return -EBADMSG;
+ r = decompress_blob(compression,
+ o->data.payload,
+ le64toh(o->object.size) - offsetof(Object, data.payload),
+ &b, &alloc, &b_size, 0);
+ if (r < 0) {
+ log_error(OFSfmt": %s decompression failed: %s", offset,
+ object_compressed_to_string(compression), strerror(-r));
+ return r;
}
h2 = hash64(b, b_size);
-#else
- log_error("XZ compression is not supported");
- return -EPROTONOSUPPORT;
-#endif
} else
h2 = hash64(o->data.payload, le64toh(o->object.size) - offsetof(Object, data.payload));