X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=rescue%2Fvirt-rescue.c;h=7c8a57b355e59b768c3249870ff911e6453880b6;hb=bddde7799b80b8292879634548c3c92a3cc1c044;hp=58be96bd1c28bd7ceedcf2779db72471dff3e1f8;hpb=a20e5c00c35490fa29668630113a01240a69b701;p=libguestfs.git diff --git a/rescue/virt-rescue.c b/rescue/virt-rescue.c index 58be96b..7c8a57b 100644 --- a/rescue/virt-rescue.c +++ b/rescue/virt-rescue.c @@ -1,5 +1,5 @@ /* virt-rescue - * Copyright (C) 2010 Red Hat Inc. + * Copyright (C) 2010-2011 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,12 +20,16 @@ #include #include +#include #include #include #include #include +#include #include +#include +#include "ignore-value.h" #include "progname.h" #include "xvasprintf.h" @@ -75,6 +79,7 @@ usage (int status) " --selinux Enable SELinux\n" " -v|--verbose Verbose messages\n" " -V|--version Display version and exit\n" + " -w|--rw Mount read-write\n" " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), program_name, program_name, program_name, @@ -93,6 +98,8 @@ main (int argc, char *argv[]) bindtextdomain (PACKAGE, LOCALEBASEDIR); textdomain (PACKAGE); + parse_config (); + enum { HELP_OPTION = CHAR_MAX + 1 }; static const char *options = "a:c:d:m:rvVx"; @@ -106,6 +113,7 @@ main (int argc, char *argv[]) { "memsize", 1, 0, 'm' }, { "network", 0, 0, 0 }, { "ro", 0, 0, 'r' }, + { "rw", 0, 0, 'w' }, { "selinux", 0, 0, 0 }, { "verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, @@ -188,6 +196,10 @@ main (int argc, char *argv[]) OPTION_V; break; + case 'w': + OPTION_w; + break; + case 'x': OPTION_x; break; @@ -278,17 +290,9 @@ main (int argc, char *argv[]) * appliance. */ guestfs_set_error_handler (g, NULL, NULL); - guestfs_launch (g); - /* launch() expects guestfsd to start. However, virt-rescue doesn't - * run guestfsd, so this will always fail with ECHILD when the - * appliance exits unexpectedly. - */ - if (errno != ECHILD) { - fprintf (stderr, "%s: %s\n", program_name, guestfs_last_error (g)); - guestfs_close (g); - exit (EXIT_FAILURE); - } + /* We expect launch to fail, so ignore the return value. */ + ignore_value (guestfs_launch (g)); guestfs_close (g);