]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh-interface: Update interface commands to use vshCommandOptStringReq
authorPeter Krempa <pkrempa@redhat.com>
Mon, 21 Jan 2013 16:25:05 +0000 (17:25 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 4 Feb 2013 13:17:44 +0000 (14:17 +0100)
tools/virsh-interface.c

index 57cfc4d61b0212ebfa57907d83950de6359890ed..5337f5e5bfbc707115ff78651a2a3020128573ff 100644 (file)
@@ -51,7 +51,7 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
     if (!vshCmdHasOption(ctl, cmd, optname))
         return NULL;
 
-    if (vshCommandOptString(cmd, optname, &n) <= 0)
+    if (vshCommandOptStringReq(ctl, cmd, optname, &n) < 0)
         return NULL;
 
     vshDebug(ctl, VSH_ERR_INFO, "%s: found option <%s>: %s\n",
@@ -503,7 +503,7 @@ cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd)
     bool ret = true;
     char *buffer;
 
-    if (vshCommandOptString(cmd, "file", &from) <= 0)
+    if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
         return false;
 
     if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
@@ -778,10 +778,8 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
     }
 
     /* Name for new bridge device */
-    if (vshCommandOptString(cmd, "bridge", &br_name) <= 0) {
-        vshError(ctl, "%s", _("Missing bridge device name in command"));
+    if (vshCommandOptStringReq(ctl, cmd, "bridge", &br_name) < 0)
         goto cleanup;
-    }
 
     /* make sure "new" device doesn't already exist */
     if ((br_handle = virInterfaceLookupByName(ctl->conn, br_name))) {