From 2360cd228542c6a523f10daacbd631a753d17208 Mon Sep 17 00:00:00 2001 From: David Scott Date: Wed, 6 Mar 2013 16:18:05 +0000 Subject: [PATCH] Functions returning "unit" correspond to C fns which use -1 for failure 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 --- 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.8.3.1