[sheepdog] [PATCH] farm: fix comparison of empty sha1

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Aug 7 14:49:35 CEST 2012


At Tue, 07 Aug 2012 20:07:48 +0800,
Liu Yuan wrote:
> 
> On 08/07/2012 07:55 PM, MORITA Kazutaka wrote:
> > If the first byte of entry->raw.sha1 is zero, strlen(entry->raw.sha1)
> > returns zero.  What this function wants to do is to check
> > entry->raw.sha1 is filled with zero, isn't it?
> 
> Yes, your fix looks okay but I thought you have met some segfault like problem
> caused by this line,

I've not ever met any problems yet.  I just noticed that the usage of
strlen is wrong.

I think the old code doesn't cause fatal problems like segfault, but
causes a redundant write to the farm backend store when the sha1 value
starts with zero.

Thanks,

Kazutaka



More information about the sheepdog mailing list