[sheepdog] [PATCH] sheep: add a helper function to copy out data from strbuf

Liu Yuan namei.unix at gmail.com
Sun May 20 18:39:12 CEST 2012


On 05/21/2012 12:25 AM, Christoph Hellwig wrote:

> On Mon, May 21, 2012 at 12:23:53AM +0900, MORITA Kazutaka wrote:
>> This patch also fixes a problem that local_get_store_list() doesn't
>> set a null terminated string.
> 
> I took a quick look at the strbuf code but can't see any explanation
> how the extra byte that it apparenly makes sure is always allocated is
> set to 0.  Any chance we could get a bit of documentation for this code?
>


strbuf_setlen() will assure us of last byte to be '\0'.

> Also how do we know the buffer we copy the strbuf to is guaranteed to be

> large enough?
> 


I think caller should guarantee it. Anyway, yes, documentation is needed
as always.

Thanks,
Yuan




More information about the sheepdog mailing list