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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]