[sheepdog] [PATCH stable-0.9] sheep/recovery: use correct length for hash digest compare

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Sun Jun 7 09:54:49 CEST 2015


From: Bingpeng Zhu <nkuzbp at foxmail.com>

We should remove sizeof operator for SHA1_DIGEST_SIZE.

Signed-off-by: Bingpeng Zhu <bingpeng.zbp at alibaba-inc.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/recovery.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sheep/recovery.c b/sheep/recovery.c
index 7874fc9..f280dbd 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -275,8 +275,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.9.1



More information about the sheepdog mailing list