memzap

replay memory writes
git clone git://git.2f30.org/memzap
Log | Files | Refs | README | LICENSE

commit 241be268e447a2c29dbf6bd01f5b59cdb9e83086
parent 1ead999b8cca9588a8e0a74d67590dd8f01d86eb
Author: sin <sin@2f30.org>
Date:   Wed,  6 Mar 2013 17:06:36 +0000

mem: Bomb out on certain conditions

Diffstat:
Mmem.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/mem.c b/mem.c @@ -158,12 +158,12 @@ diff_mem_region(struct mem_region *dst, mb_src = &src->mblks[i]; mb_dst = &dst->mblks[i]; if (mb_src->weak_sum == mb_dst->weak_sum) { - if (mb_src->offset == mb_dst->offset) { - if (!memcmp(mb_src->digest, - mb_dst->digest, - MD5_DIGEST_LENGTH)) { - found = true; - } + if (mb_src->offset != mb_dst->offset) + errx(1, "mb_src->offset != mb_dst->offset"); + if (!memcmp(mb_src->digest, + mb_dst->digest, + MD5_DIGEST_LENGTH)) { + found = true; } } if (!found) { @@ -204,7 +204,7 @@ apply_diff(struct mem_region *dst, fprintf(stderr, "patching block %d\n", mdiff->index); if (mdiff->len != mb->len) - errx(1, "wtf?"); + errx(1, "mdiff->len != mb->len"); /* Patch it! */ memcpy(mb->buf, mdiff->buf, mb->len); }