mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
Fix build without any compression enabled
This commit is contained in:
parent
6017365a1d
commit
3b1a55e110
@ -3667,9 +3667,11 @@ tests += \
|
||||
test-mmap-cache \
|
||||
test-catalog
|
||||
|
||||
if HAVE_COMPRESSION
|
||||
tests += \
|
||||
test-compress \
|
||||
test-compress-benchmark
|
||||
endif
|
||||
|
||||
pkginclude_HEADERS += \
|
||||
src/systemd/sd-journal.h \
|
||||
|
@ -520,6 +520,8 @@ AS_IF([test "x$enable_lz4" == "xyes"], [
|
||||
])
|
||||
AM_CONDITIONAL(HAVE_LZ4, [test "$have_lz4" = "yes"])
|
||||
|
||||
AM_CONDITIONAL(HAVE_COMPRESSION, [test "$have_xz" = "yes" -o "$have_lz4" = "yes"])
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
AC_ARG_ENABLE([pam],
|
||||
AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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, '=')) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user