tMake bcheck() return 1 if a block hash mismatch was detected - dedup - deduplicating backup program
(HTM) git clone git://git.z3bra.org/dedup.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit bfcf7e2d112888bb42b40e2d25211edc7375f8c5
(DIR) parent 40ea72e15035e85c7184d9d12ee572a6bee59034
(HTM) Author: sin <sin@2f30.org>
Date: Sun, 5 May 2019 21:03:39 +0100
Make bcheck() return 1 if a block hash mismatch was detected
Diffstat:
M bstorage.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/bstorage.c b/bstorage.c
t@@ -675,7 +675,9 @@ bsgc(struct bctx *bctx)
/*
* Lookup the block given hash and rehash it.
- * Check that the hashes match.
+ * Check that the hashes match. It returns -1
+ * on error, 0 on success and 1 if a block hash
+ * mismatch is detected.
*/
static int
bscheck(struct bctx *bctx, unsigned char *md)
t@@ -718,8 +720,7 @@ bscheck(struct bctx *bctx, unsigned char *md)
if (memcmp(key.md, md, MDSIZE) != 0) {
free(buf);
- bseterr("block mismatch");
- return -1;
+ return 1;
}
free(buf);
return 0;