dedup

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

commit bfcf7e2d112888bb42b40e2d25211edc7375f8c5
parent 40ea72e15035e85c7184d9d12ee572a6bee59034
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:
Mbstorage.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bstorage.c b/bstorage.c @@ -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) @@ -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;