From 0e5174333ec0d99114cd1d94b5476cc117cca2e1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 9 Dec 2011 09:49:37 +0000 Subject: [PATCH] fish: -i option should fail if / is not mountable, but warn about others. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In particular this stops a problem with guestmount where if the -i option half-recognizes the guest OS, it would mount the disk (and fail, giving only warnings), leaving the mountpoint unusable. (Thanks Pádraig Brady) (cherry picked from commit 54e91da925323642e67b8ce4b95899fe4b7a51c4) --- fish/inspect.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fish/inspect.c b/fish/inspect.c index 7d4401e..f93367b 100644 --- a/fish/inspect.c +++ b/fish/inspect.c @@ -154,8 +154,14 @@ inspect_mount_root (const char *root) r = guestfs_mount_options (g, "", mountpoints[i+1], mountpoints[i]); else r = guestfs_mount_ro (g, mountpoints[i+1], mountpoints[i]); - if (r == -1) + if (r == -1) { + /* If the "/" filesystem could not be mounted, give up, else + * just count the errors and print a warning. + */ + if (STREQ (mountpoints[i], "/")) + exit (EXIT_FAILURE); mount_errors++; + } } free_strings (mountpoints); -- 1.8.3.1