[libvirt] [PATCH 2/8] virsh: allow zero length arguments

Lai Jiangshan laijs at cn.fujitsu.com
Tue Oct 12 07:13:28 UTC 2010


the following command is allowed at shell, we also make it allowed at virsh shel.
# somecmd ""

Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
diff --git a/tools/virsh.c b/tools/virsh.c
index 7b6f2b6..1e95023 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -10175,7 +10175,6 @@ vshCommandGetToken(vshControl *ctl, char *str, char **end, char **res)
     bool double_quote = false;
     int sz = 0;
     char *p = str, *q;
-    char *tkstr = NULL;
 
     *end = NULL;
 
@@ -10211,7 +10210,6 @@ copy:
             } else {
                 tk = VSH_TK_DATA;
             }
-            tkstr = p;          /* begin of token */
         }
 
 	if (*p == '"') {
@@ -10229,10 +10227,6 @@ copy:
         vshError(ctl, "%s", _("missing \""));
         return VSH_TK_ERROR;
     }
-    if (tkstr == NULL || *tkstr == '\0' || p == NULL)
-        return VSH_TK_END;
-    if (sz == 0)
-        return VSH_TK_END;
 
     if (!*res) {
         *res = vshMalloc(ctl, sz + 1);




More information about the libvir-list mailing list