summaryrefslogtreecommitdiff
path: root/src/journal/coredumpctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-03 22:42:22 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-06 19:06:03 -0400
commitd89c8fdf48c7bad5816b9f2e77e8361721f22517 (patch)
tree12d384fffafa1789079b7ed51c4d33d5d10116c0 /src/journal/coredumpctl.c
parent5e592c66bdf76dfc8445b332f7a5088ca504ee90 (diff)
journal: add LZ4 as optional compressor
Add liblz4 as an optional dependency when requested with --enable-lz4, and use it in preference to liblzma for journal blob and coredump compression. To retain backwards compatibility, XZ is used to decompress old blobs. Things will function correctly only with lz4-119. Based on the benchmarks found on the web, lz4 seems to be the best choice for "quick" compressors atm. For pkg-config status, see http://code.google.com/p/lz4/issues/detail?id=135.
Diffstat (limited to 'src/journal/coredumpctl.c')
-rw-r--r--src/journal/coredumpctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 2158d73771..5d6b2c7adf 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -600,7 +600,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
filename = NULL;
}
- if (filename && !endswith(filename, ".xz")) {
+ if (filename && !endswith(filename, ".xz") && !endswith(filename, ".lz4")) {
if (path) {
*path = filename;
filename = NULL;
@@ -646,7 +646,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
goto error;
}
} else if (filename) {
-#ifdef HAVE_XZ
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
_cleanup_close_ int fdf;
fdf = open(filename, O_RDONLY | O_CLOEXEC);
@@ -656,13 +656,13 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
goto error;
}
- r = decompress_stream(fdf, fd, -1);
+ r = decompress_stream(filename, fdf, fd, -1);
if (r < 0) {
log_error("Failed to decompress %s: %s", filename, strerror(-r));
goto error;
}
#else
- log_error("Cannot decompress file. Compiled without XZ support.");
+ log_error("Cannot decompress file. Compiled without compression support.");
r = -ENOTSUP;
goto error;
#endif