From e9ce7a5ed2519c90ec9acc5cc6afe6e996d1bd2e Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Sun, 26 May 2013 23:38:10 +0530 Subject: [PATCH] Fix a crash with invalid PCOMPRESS_CHUNK_HASH_GLOBAL. Update testcase to correctly detect core files. --- rabin/rabin_dedup.c | 2 +- test/t9.tst | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/rabin/rabin_dedup.c b/rabin/rabin_dedup.c index 2fd4fb4..7182787 100755 --- a/rabin/rabin_dedup.c +++ b/rabin/rabin_dedup.c @@ -228,7 +228,7 @@ create_dedupe_context(uint64_t chunksize, uint64_t real_chunksize, int rab_blk_s if (get_checksum_props(ck, &chunk_cksum, &cksum_bytes, &mac_bytes, 1) != 0 || strcmp(ck, "CRC64") == 0) { fprintf(stderr, "Invalid PCOMPRESS_CHUNK_HASH_GLOBAL. Reverting to default.\n"); - chunk_cksum = -1; + chunk_cksum = 0; } } if (chunk_cksum == 0) { diff --git a/test/t9.tst b/test/t9.tst index 8f50112..099462b 100644 --- a/test/t9.tst +++ b/test/t9.tst @@ -31,6 +31,12 @@ then rm -f ${tstf}.pz fi unset PCOMPRESS_CHUNK_HASH_GLOBAL +if [ -f core* ] +then + echo "FATAL: Compression crashed" + rm -f ${tstf}.pz + rm -f core* +fi for feat in "-L" "-L -D" "-L -D -E -M -C" "-L -B5" "-L -D -E -B2" "-F" "-F -L" do @@ -47,6 +53,7 @@ do then echo "FATAL: Compression crashed" rm -f ${tstf}.pz + rm -f core* break fi rm -f ${tstf}.pz