[Libguestfs] [PATCHx7] Misc patches

Richard W.M. Jones rjones at redhat.com
Thu Aug 13 15:05:50 UTC 2009


On Thu, Aug 13, 2009 at 04:59:57PM +0200, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> 
> >>From dcd67e2c4e81bb270ea7f5ed8b6675b114afca60 Mon Sep 17 00:00:00 2001
> > From: Richard Jones <rjones at trick.home.annexia.org>
> > Date: Thu, 13 Aug 2009 14:41:05 +0100
> > Subject: [PATCH 4/7] In rmmountpoint, have to explicitly check for ABS_PATH (*not* NEED_ROOT).
> >
> > ---
> >  daemon/mount.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/daemon/mount.c b/daemon/mount.c
> > index 4f74c02..d1b26fa 100644
> > --- a/daemon/mount.c
> > +++ b/daemon/mount.c
> > @@ -373,6 +373,9 @@ do_rmmountpoint (const char *path)
> >  {
> >    int r;
> >
> > +  /* NEED_ROOT (return -1); - we don't want this test for this call. */
> > +  ABS_PATH (path, return -1);
> > +
> >    CHROOT_IN;
> >    r = rmdir (path);
> >    CHROOT_OUT;
> 
> Why?  I note that before my commit, 84fc760439e82e6b3616abd0d1f9bd7d7eb01ec0
> it had both:
> 
>   -  NEED_ROOT (return -1);
>   -  ABS_PATH (path, return -1);
>   -
> 
> When I switched back from Pathname to String,
> shouldn't I have restored both?

I don't know if what was there before was correct, but the semantics
of rmmountpoint are:

(1) You can remove a mountpoint when nothing is mounted (pretty
important for removing the final mountpoint).

(2) Mountpoints should be paths.

And the proposed code does that correctly.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list