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

2010-10-12 Thread Lai Jiangshan
the following command is allowed at shell, we also make it allowed at virsh 
shel.
# somecmd 

Signed-off-by: Lai Jiangshan la...@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);

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


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

2010-10-12 Thread Eric Blake

On 10/12/2010 01:13 AM, Lai Jiangshan wrote:

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


s/shel/shell/


# somecmd 

Signed-off-by: Lai Jiangshanla...@cn.fujitsu.com
---


ACK.  But I'm wondering what sort of subtle surprises we might now get 
in any client that is not prepared to handle an empty argument.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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