From: Peter Krempa Date: Mon, 21 Jan 2013 16:17:19 +0000 (+0100) Subject: virsh-host: Update host commands to use vshCommandOptStringReq X-Git-Tag: v1.0.3-rc1~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edbdc45b6dc2b1578e335195b64ea6829e87417c;p=thirdparty%2Flibvirt.git virsh-host: Update host commands to use vshCommandOptStringReq --- diff --git a/tools/virsh-host.c b/tools/virsh-host.c index b83c893ad3..cfed65c11c 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -103,10 +103,9 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd) } VIR_FREE(ctl->name); - if (vshCommandOptString(cmd, "name", &name) < 0) { - vshError(ctl, "%s", _("Please specify valid connection URI")); + if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0) return false; - } + ctl->name = vshStrdup(ctl, name); ctl->useGetInfo = false; @@ -550,10 +549,8 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd) unsigned int suspendTarget; long long duration; - if (vshCommandOptString(cmd, "target", &target) < 0) { - vshError(ctl, _("Invalid target argument")); + if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0) return false; - } if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) { vshError(ctl, _("Invalid duration argument"));