summaryrefslogtreecommitdiffstats
path: root/fuse
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-10-26 20:53:30 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-10-26 20:53:30 +0100
commitb0eabcca60da8fec55cbeaf83e17320281ed75b8 (patch)
treea00ae35722b09324ad5a50e0c8e18809278c9b6f /fuse
parentbf7f3170eadb8be5a74a7698a6f7b1dda7a27541 (diff)
downloadlibguestfs-b0eabcca60da8fec55cbeaf83e17320281ed75b8.tar.gz
libguestfs-b0eabcca60da8fec55cbeaf83e17320281ed75b8.tar.xz
libguestfs-b0eabcca60da8fec55cbeaf83e17320281ed75b8.zip
guestmount: Fix --live option (RHBZ#744795).
Diffstat (limited to 'fuse')
-rw-r--r--fuse/guestmount.c51
-rw-r--r--fuse/guestmount.pod6
2 files changed, 49 insertions, 8 deletions
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index 1e3b5dbe..67a746f5 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -1125,11 +1125,52 @@ main (int argc, char *argv[])
}
/* Check we have the right options. */
- if (!drvs || !(mps || inspector)) {
- fprintf (stderr,
- _("%s: must have at least one -a/-d and at least one -m/-i option\n"),
- program_name);
- exit (EXIT_FAILURE);
+ if (!live) {
+ if (!drvs || !(mps || inspector)) {
+ fprintf (stderr,
+ _("%s: must have at least one -a/-d and at least one -m/-i option\n"),
+ program_name);
+ exit (EXIT_FAILURE);
+ }
+ } else {
+ size_t count_d = 0, count_other = 0;
+ struct drv *drv;
+
+ if (read_only) {
+ fprintf (stderr,
+ _("%s: --live is not compatible with --ro option\n"),
+ program_name);
+ exit (EXIT_FAILURE);
+ }
+
+ if (inspector) {
+ fprintf (stderr,
+ _("%s: --live is not compatible with -i option\n"),
+ program_name);
+ exit (EXIT_FAILURE);
+ }
+
+ /* --live: make sure there was one -d option and no -a options */
+ for (drv = drvs; drv; drv = drv->next) {
+ if (drv->type == drv_d)
+ count_d++;
+ else
+ count_other++;
+ }
+
+ if (count_d != 1) {
+ fprintf (stderr,
+ _("%s: with --live, you must use exactly one -d option\n"),
+ program_name);
+ exit (EXIT_FAILURE);
+ }
+
+ if (count_other != 0) {
+ fprintf (stderr,
+ _("%s: --live is not compatible with -a option\n"),
+ program_name);
+ exit (EXIT_FAILURE);
+ }
}
/* We'd better have a mountpoint. */
diff --git a/fuse/guestmount.pod b/fuse/guestmount.pod
index 9756a8b1..40a76986 100644
--- a/fuse/guestmount.pod
+++ b/fuse/guestmount.pod
@@ -26,9 +26,9 @@ userspace") to make it appear as a mountable device.
Along with other options, you have to give at least one device (I<-a>
option) or libvirt domain (I<-d> option), and at least one mountpoint
-(I<-m> option) or use the I<-i> inspection option. How this works is
-better explained in the L<guestfish(1)> manual page, or by looking at
-the examples below.
+(I<-m> option) or use the I<-i> inspection option or the I<--live>
+option. How this works is better explained in the L<guestfish(1)>
+manual page, or by looking at the examples below.
FUSE lets you mount filesystems as non-root. The mountpoint must be
owned by you, and the filesystem will not be visible to any other