[libvirt] [PATCH 3/3] Functions returning "unit" correspond to C fns which use -1 for failure

David Scott scott.dj at gmail.com
Wed Mar 6 16:18:05 UTC 2013


This affects the following functions:
  virStoragePoolBuild
  virStoragePoolDelete
  virStorageVolDelete

Previously a call to virStorageVolDelete would succeed returning 0, which
was interpreted as false, causing us to raise an exception with
VIR_ERR_NONE.

Signed-off-by: David Scott <dave.scott at eu.citrix.com>
---
 libvirt/generator.pl |    2 +-
 libvirt/libvirt_c.c  |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libvirt/generator.pl b/libvirt/generator.pl
index 8590ea7..abebfff 100755
--- a/libvirt/generator.pl
+++ b/libvirt/generator.pl
@@ -749,7 +749,7 @@ sub gen_c_code
   int r;
 
   NONBLOCKING (r = $c_name ($1, i));
-  CHECK_ERROR (!r, conn, \"$c_name\");
+  CHECK_ERROR (r == -1, conn, \"$c_name\");
 
   CAMLreturn (Val_unit);
 "
diff --git a/libvirt/libvirt_c.c b/libvirt/libvirt_c.c
index b1f084b..d07a55e 100644
--- a/libvirt/libvirt_c.c
+++ b/libvirt/libvirt_c.c
@@ -1932,7 +1932,7 @@ ocaml_libvirt_storage_pool_build (value poolv, value iv)
   int r;
 
   NONBLOCKING (r = virStoragePoolBuild (pool, i));
-  CHECK_ERROR (!r, conn, "virStoragePoolBuild");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolBuild");
 
   CAMLreturn (Val_unit);
 #endif
@@ -2038,7 +2038,7 @@ ocaml_libvirt_storage_pool_delete (value poolv, value iv)
   int r;
 
   NONBLOCKING (r = virStoragePoolDelete (pool, i));
-  CHECK_ERROR (!r, conn, "virStoragePoolDelete");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolDelete");
 
   CAMLreturn (Val_unit);
 #endif
@@ -2309,7 +2309,7 @@ ocaml_libvirt_storage_vol_delete (value volv, value iv)
   int r;
 
   NONBLOCKING (r = virStorageVolDelete (vol, i));
-  CHECK_ERROR (!r, conn, "virStorageVolDelete");
+  CHECK_ERROR (r == -1, conn, "virStorageVolDelete");
 
   CAMLreturn (Val_unit);
 #endif
-- 
1.7.10.4




More information about the libvir-list mailing list