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

[libvirt] [PATCH] virsh: Fix a problem of argv parsing



Problem example:
  # virsh -d 5 vol-create --pool default col.xml
  vol-create: pool(optdata): default
  vol-create: pool(optdata): col.xml
  error: command 'vol-create' requires <file> option

  It gets same "vshCmdOptDef" for both "--pool default"
  and "col.xml".

This patch fixes it by increase "data_ct" when things like
"--pool default" is successfully parsed, so that could
get right "vshCmdOptDef" for the other arguments which
are not with option name together.
---
 tools/virsh.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 19e3449..4d52bfb 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11750,6 +11750,8 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
                                  VSH_OT_INT ? _("number") : _("string"));
                         goto syntaxError;
                     }
+
+                    data_ct++;
                 } else {
                     tkdata = NULL;
                     if (optstr) {
--
1.7.4


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