From 24e2740222dcebd76c8c5340298d4dbf7660c935 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 5 Jul 2014 02:09:05 +0100 Subject: [PATCH] progs/hashsum.c (checkhash): Fix stupid bugs. * Initialize the return code. Not sure why this didn't get a warning. * Pick up changes of hash function properly. --- progs/hashsum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/progs/hashsum.c b/progs/hashsum.c index 8cc19265..df1fdaea 100644 --- a/progs/hashsum.c +++ b/progs/hashsum.c @@ -90,7 +90,7 @@ static int warnjunk(const char *path, const struct stat *st, void *p) static int checkhash(fhashstate *fh, const char *file, const encodeops *e) { - int rc; + int rc = 0; hfpctx hfp; dstr dl = DSTR_INIT; dstr df = DSTR_INIT; @@ -116,6 +116,7 @@ static int checkhash(fhashstate *fh, const char *file, const encodeops *e) case HF_HASH: xfree(hfp.hbuf); hfp.hbuf = xmalloc(2 * hfp.gch->hashsz); + fh->gch = hfp.gch; break; case HF_FILE: if (fhash(fh, df.buf, hfp.hbuf + hfp.gch->hashsz)) { -- 2.11.0