[libvirt] [PATCH] tools: fix a judgment of equalling zero about an array's length

lawrancejing lawrancejing at gmail.com
Thu Sep 12 06:12:21 UTC 2013


There is no need to go on executing code when the array's length is zero.
---
 tools/virsh-snapshot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index e37a5b3..d7a4c7b 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -239,7 +239,7 @@ vshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str)
         return 0;
 
     narray = vshStringToArray(str, &array);
-    if (narray < 0)
+    if (narray <= 0)
         goto cleanup;
 
     for (i = 0; i < narray; i++) {
-- 
1.7.1




More information about the libvir-list mailing list