[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[libvirt] [PATCH]: fix ruby-libvirt bindings when virConnectNum* returns 0
- From: Chris Lalancette <clalance redhat com>
- To: David Lutterkort <dlutter redhat com>
- Cc: libvir-list redhat com
- Subject: [libvirt] [PATCH]: fix ruby-libvirt bindings when virConnectNum* returns 0
- Date: Tue, 17 Jun 2008 11:16:31 +0200
Attached is a simple patch to fix a problem I ran into when using the
ruby-libvirt bindings with libvirt 0.4.3. Basically, if you call any of the
virConnectList* functions with a "max" of 0, it returns "Invalid Arg". To get
around this, modify the ruby-libvirt bindings to return an empty list if we get
num == 0 when calling the corresponding virConnectNumOf* function. This should
solve: https://bugzilla.redhat.com/show_bug.cgi?id=451666
Signed-off-by: Chris Lalancette <clalance redhat com>
diff -r b02171cfad7d ext/libvirt/_libvirt.c
--- a/ext/libvirt/_libvirt.c Wed Apr 16 09:47:27 2008 -0700
+++ b/ext/libvirt/_libvirt.c Tue Jun 17 11:06:26 2008 +0200
@@ -256,7 +256,11 @@ static VALUE vol_new(virStorageVolPtr n,
\
num = virConnectNumOf##objs(conn); \
_E(num < 0, create_error(e_RetrieveError, "virConnectNumOf" # objs, "", conn)); \
- \
+ if (num == 0) { \
+ /* if num is 0, don't call virConnectList* function */ \
+ result = rb_ary_new2(num); \
+ return result; \
+ } \
names = ALLOC_N(char *, num); \
r = virConnectList##objs(conn, names, num); \
if (r < 0) { \
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]