[CRIU] [PATCH 2/5] mounts: use relative paths for mountpoints

Cyrill Gorcunov gorcunov at gmail.com
Sat Feb 22 05:28:15 PST 2014


On Sat, Feb 22, 2014 at 04:07:54PM +0400, Andrew Vagin wrote:
> On Sat, Feb 22, 2014 at 04:00:34PM +0400, Andrew Vagin wrote:
> > On Sat, Feb 22, 2014 at 12:49:26PM +0400, Pavel Emelyanov wrote:
> > > On 02/21/2014 05:51 PM, Andrey Vagin wrote:
> > > 
> > > This comment sucks.
> > > 
> > > > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > > > ---
> > > >  mount.c | 11 +++++++----
> > > >  1 file changed, 7 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/mount.c b/mount.c
> > > > index 4d66dd9..d315e4c 100644
> > > > --- a/mount.c
> > > > +++ b/mount.c
> > > > @@ -47,7 +47,7 @@ static int validate_mounts(struct mount_info *info, bool call_plugins);
> > > >  
> > > >  static inline int is_root(char *p)
> > > >  {
> We can rewrite it like this
> 	if (*p == '.')
> 		p++;
> 	return p[0] == '/' && p[1] == '\0';
> > > > +	return (!strcmp(p, "/") || !strcmp(p, "./"));

I don't see much point in such hack. strcmp most likely will be
optimised by compiler, until contrary proven.


More information about the CRIU mailing list