X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fcompress.c;h=9440fcd60ef4638b4aa93d5ba591cdb6eaabe756;hb=a2341f6836da0a217ab0c5f2b82f0c4ea13d429d;hp=52a4c100b338fd9d08936f742eb4427d97c68bd6;hpb=fa1c4b518ec7d8ec2d647213ee651cde4d6c9d7e;p=elogind.git diff --git a/src/journal/compress.c b/src/journal/compress.c index 52a4c100b..9440fcd60 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -400,12 +400,9 @@ int compress_stream_xz(int fdf, int fdt, off_t max_bytes) { n = sizeof(out) - s.avail_out; - errno = 0; k = loop_write(fdt, out, n, false); if (k < 0) return k; - if (k != n) - return errno ? -errno : -EIO; if (ret == LZMA_STREAM_END) { log_debug("XZ compression finished (%"PRIu64" -> %"PRIu64" bytes, %.1f%%)", @@ -460,10 +457,10 @@ int compress_stream_lz4(int fdf, int fdt, off_t max_bytes) { total_in += n; - r = LZ4_compress_limitedOutput_continue(&lz4_data, buf, out, n, n); + r = LZ4_compress_continue(&lz4_data, buf, out, n); if (r == 0) { - log_debug("Compressed size exceeds original, aborting compression."); - return -ENOBUFS; + log_error("LZ4 compression failed."); + return -EBADMSG; } header = htole32(r); @@ -478,8 +475,6 @@ int compress_stream_lz4(int fdf, int fdt, off_t max_bytes) { n = loop_write(fdt, out, r, false); if (n < 0) return n; - if (n != r) - return errno ? -errno : -EIO; total_out += sizeof(header) + r; @@ -559,12 +554,9 @@ int decompress_stream_xz(int fdf, int fdt, off_t max_bytes) { max_bytes -= n; } - errno = 0; k = loop_write(fdt, out, n, false); if (k < 0) return k; - if (k != n) - return errno ? -errno : -EIO; if (ret == LZMA_STREAM_END) { log_debug("XZ decompression finished (%"PRIu64" -> %"PRIu64" bytes, %.1f%%)", @@ -645,12 +637,9 @@ int decompress_stream_lz4(int fdf, int fdt, off_t max_bytes) { return -EFBIG; } - errno = 0; n = loop_write(fdt, out, r, false); if (n < 0) return n; - if (n != r) - return errno ? -errno : -EIO; } log_debug("LZ4 decompression finished (%zu -> %zu bytes, %.1f%%)",