summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-12-13 14:20:21 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-12-13 15:00:19 -0500
commitd487b8151319a19313786feeba3af610bfb1a45f (patch)
tree653c7efa89f91caef3df392adcee77e4a8fed2f9
parent5d6f46b6bf7804af8c1ba780f72a37dc37193428 (diff)
journal: fix reporting of output size in compres_stream_lz4
The header is 7 bytes, and this size was not accounted for in total_out. This means that we could create a file that was 7 bytes longer than requested, and the debug output was also inconsistent.
-rw-r--r--src/journal/compress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/compress.c b/src/journal/compress.c
index e1ab4a46f5..1828165894 100644
--- a/src/journal/compress.c
+++ b/src/journal/compress.c
@@ -451,7 +451,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {
_cleanup_(LZ4F_freeCompressionContextp) LZ4F_compressionContext_t ctx = NULL;
_cleanup_free_ char *buf = NULL;
char *src = NULL;
- size_t size, n, total_in = 0, total_out = 0, offset = 0, frame_size;
+ size_t size, n, total_in = 0, total_out, offset = 0, frame_size;
struct stat st;
int r;
static const LZ4F_compressOptions_t options = {
@@ -474,7 +474,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {
if (!buf)
return -ENOMEM;
- n = offset = LZ4F_compressBegin(ctx, buf, size, &preferences);
+ n = offset = total_out = LZ4F_compressBegin(ctx, buf, size, &preferences);
if (LZ4F_isError(n))
return -EINVAL;