dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

commit 09d67581b67a79e9948d48e20b2f0f64e7fd0123
parent 775d12f9317d5da57933c7641ed3a38f620f81fe
Author: sin <sin@2f30.org>
Date:   Tue, 19 Feb 2019 09:09:14 +0000

Check comp/decomp() return code

Diffstat:
Mdedup.c | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dedup.c b/dedup.c @@ -188,13 +188,23 @@ comp_size(size_t size) size_t comp(uint8_t *in, uint8_t *out, size_t insize, size_t outsize) { - return LZ4_compress_default((char *)in, (char *)out, insize, outsize); + int ret; + + ret = LZ4_compress_default((char *)in, (char *)out, insize, outsize); + if (ret < 0) + errx(1, "LZ4_compress_default failed"); + return ret; } size_t decomp(uint8_t *in, uint8_t *out, size_t insize, size_t outsize) { - return LZ4_decompress_safe((char *)in, (char *)out, insize, outsize); + int ret; + + ret = LZ4_decompress_safe((char *)in, (char *)out, insize, outsize); + if (ret < 0) + errx(1, "LZ4_decompress_safe failed"); + return ret; } void