[Devel] [PATCH criu 1/3] mount: Add export_mnt_ns_roots helper

Cyrill Gorcunov gorcunov at gmail.com
Tue Oct 24 10:12:41 MSK 2017


On Mon, Oct 23, 2017 at 03:27:01PM -0700, Andrei Vagin wrote:
> > +
> > +	dst[0] = '\0';
> > +	for (nsid = ns_ids; nsid; nsid = nsid->next) {
> > +		if (nsid->nd != &mnt_ns_desc)
> > +			continue;
> > +
> > +		len = print_ns_root(nsid, 0, p, size);
> > +		if (len >= (size - 2)) {
> > +			p[(size - 1)] = '\0';
> > +			return dst;
> > +		}
> > +
> > +		size -= len;
> > +		p += len;
> > +		p[0] = ' ';
> > +		p++, size--;
> > +	}
> > +
> 	do you forget to add \0 to the end?
> 
> 	if (p != dst)
> 		*(p - 1) = 0;

True, thanks!


More information about the Devel mailing list