Fold checks into one - dedup - deduplicating backup program HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 5064abfd02125645e6099f376feca283e1edd745 DIR parent 7d0f66f519a36d47db6919100238e74a5eeba713 HTML Author: sin <sin@2f30.org> Date: Thu, 16 May 2019 14:36:11 +0300 Fold checks into one Diffstat: M block.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) --- DIR diff --git a/block.c b/block.c @@ -147,20 +147,13 @@ bcheck(struct bctx *bctx, unsigned char *md) } n = BSIZEMAX; - if (bcompressops()->get(bctx, md, buf, &n) < 0) { + if (bcompressops()->get(bctx, md, buf, &n) < 0 || + bhash(buf, n, tmp) < 0 || + memcmp(tmp, md, MDSIZE) != 0) { free(buf); return -1; } - if (bhash(buf, n, tmp) < 0) { - free(buf); - return -1; - } - - if (memcmp(tmp, md, MDSIZE) != 0) { - free(buf); - return -1; - } free(buf); return 0; }