[sheepdog] [PATCH v1] sheep/recovery: use correct length for hash digest compare

Bingpeng Zhu nkuzbp at foxmail.com
Tue May 26 11:47:07 CEST 2015


We should remove sizeof operator for SHA1_DIGEST_SIZE.

Signed-off-by: Bingpeng Zhu <bingpeng.zbp at alibaba-inc.com>
---
 sheep/recovery.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/sheep/recovery.c b/sheep/recovery.c
index 7e724c9..12a293a 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -274,8 +274,7 @@ static int recover_object_from(struct recovery_obj_work *row,
 		if (ret != SD_RES_SUCCESS)
 			return ret;
 
-		if (memcmp(rsp->hash.digest, sha1,
-			   sizeof(SHA1_DIGEST_SIZE)) == 0) {
+		if (memcmp(rsp->hash.digest, sha1, SHA1_DIGEST_SIZE) == 0) {
 			sd_debug("use local replica at epoch %d", local_epoch);
 			ret = sd_store->link(oid, local_epoch);
 			if (ret == SD_RES_SUCCESS)
-- 
1.7.1






More information about the sheepdog mailing list