diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-05-24 14:50:20 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-05-24 14:54:54 +0100 |
commit | ee9ab52bc3e087f63dcc51d3b6ac5c79277425e1 (patch) | |
tree | 9ce1f5f96a3b844a740698b43f2163a0d5667c25 | |
parent | 216a6d16abdfbc36a5514df34f59507ef825e33e (diff) | |
download | libguestfs-ee9ab52bc3e087f63dcc51d3b6ac5c79277425e1.tar.gz libguestfs-ee9ab52bc3e087f63dcc51d3b6ac5c79277425e1.tar.xz libguestfs-ee9ab52bc3e087f63dcc51d3b6ac5c79277425e1.zip |
fish/mount: Add better error message when -m (mount) fails (RHBZ#824043).
-rw-r--r-- | daemon/mount.c | 3 | ||||
-rw-r--r-- | fish/options.c | 20 |
2 files changed, 16 insertions, 7 deletions
diff --git a/daemon/mount.c b/daemon/mount.c index 293353db..0661eb87 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -154,7 +154,8 @@ do_mount_vfs (const char *options, const char *vfstype, "mount", "-o", options, device, mp, NULL); free (mp); if (r == -1) { - reply_with_error ("%s on %s: %s", device, mountpoint, error); + reply_with_error ("%s on %s (options: '%s'): %s", + device, mountpoint, options, error); free (error); return -1; } diff --git a/fish/options.c b/fish/options.c index 764c8092..a2b4ca48 100644 --- a/fish/options.c +++ b/fish/options.c @@ -104,7 +104,7 @@ add_drives (struct drv *drv, char next_drive) return next_drive; } -static void display_mountpoints_on_failure (const char *mp_device); +static void display_mountpoints_on_failure (const char *mp_device, const char *user_supplied_options); static void canonical_device_name (char *dev); /* List is built in reverse order, so mount them in reverse order. */ @@ -126,7 +126,7 @@ mount_mps (struct mp *mp) r = guestfs_mount_options (g, options, mp->device, mp->mountpoint); if (r == -1) { - display_mountpoints_on_failure (mp->device); + display_mountpoints_on_failure (mp->device, mp->options); exit (EXIT_FAILURE); } } @@ -136,7 +136,8 @@ mount_mps (struct mp *mp) * message listing the mountpoints. */ static void -display_mountpoints_on_failure (const char *mp_device) +display_mountpoints_on_failure (const char *mp_device, + const char *user_supplied_options) { char **fses; size_t i; @@ -149,13 +150,20 @@ display_mountpoints_on_failure (const char *mp_device) return; } - fprintf (stderr, - _("%s: '%s' could not be mounted. Did you mean one of these?\n"), + fprintf (stderr, _("%s: '%s' could not be mounted.\n"), program_name, mp_device); + if (user_supplied_options) + fprintf (stderr, _("%s: Check mount(8) man page to ensure options '%s'\n" + "%s: are supported by the filesystem that is being mounted.\n"), + program_name, user_supplied_options, program_name); + + fprintf (stderr, _("%s: Did you mean to mount one of these filesystems?\n"), + program_name); + for (i = 0; fses[i] != NULL; i += 2) { canonical_device_name (fses[i]); - fprintf (stderr, "\t%s (%s)\n", fses[i], fses[i+1]); + fprintf (stderr, "%s: \t%s (%s)\n", program_name, fses[i], fses[i+1]); free (fses[i]); free (fses[i+1]); } |