[libvirt] [PATCH v3 1/2] vshCommandOptString returns -1 if option is empty and not VSH_OFLAG_EMPTY_OK

Hu Tao hutao at cn.fujitsu.com
Fri Jul 15 07:06:52 UTC 2011


Pointed out by Eric. Thanks.
---
 tools/virsh.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index b7cea58..b43af70 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -12375,8 +12375,13 @@ vshCommandOptString(const vshCmd *cmd, const char *name, const char **value)
             vshError(NULL, _("Missing required option '%s'"), name);
             ret = -1;
         } else {
-            /* Treat "--option ''" as if option had not been specified. */
-            ret = 0;
+            /* --option '' */
+            if (arg->def->flag & VSH_OFLAG_EMPTY_OK) {
+                ret = 0;
+            } else {
+                vshError(NULL, _("option '%s' is empty"), name);
+                ret = -1;
+            }
         }
     }
 
-- 
1.7.5.1




More information about the libvir-list mailing list