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

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue May 26 15:40:57 CEST 2015


At Tue, 26 May 2015 17:47:07 +0800,
Bingpeng Zhu wrote:
> 
> 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(-)

Applied, thanks.
Hitoshi

> 
> 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
> 
> 
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog


More information about the sheepdog mailing list