[sheepdog] [PATCH] md: trim last slashes from paths

MORITA Kazutaka morita.kazutaka at gmail.com
Wed Apr 17 17:39:41 CEST 2013

At Wed, 17 Apr 2013 23:17:35 +0800,
Liu Yuan wrote:
> On 04/17/2013 11:13 PM, MORITA Kazutaka wrote:
> > This cannot handle a zero-length string.  Although we don't pass "" to
> > this function currently, adding
> > 
> >     if (path[0] == '\0')
> >         return;
> > 
> > before the while loop looks better to me.
> MD can't handle zero-length string and no need to. I think it is better
> to add zero-length string check at collie side.

Can we add at least 'assert(path[0])'?  Other developers might change
MD codes and wrongly call the function in future.  If we pass "" to
this function, it causes a severe problem.  We should add a strict
check for such cases even if it is obvious to the author that it
cannot happen.



More information about the sheepdog mailing list