commit fecf79960e6acd97640b944b9b7d653e5c2b5a52
parent 5064abfd02125645e6099f376feca283e1edd745
Author: sin <sin@2f30.org>
Date: Thu, 16 May 2019 12:39:42 +0100
Revert "Fold checks into one"
This reverts commit 5064abfd02125645e6099f376feca283e1edd745.
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
@@ -147,13 +147,20 @@ bcheck(struct bctx *bctx, unsigned char *md)
}
n = BSIZEMAX;
- if (bcompressops()->get(bctx, md, buf, &n) < 0 ||
- bhash(buf, n, tmp) < 0 ||
- memcmp(tmp, md, MDSIZE) != 0) {
+ if (bcompressops()->get(bctx, md, buf, &n) < 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;
}