[libvirt] hooks mechanism - possible source code bug

Paolo Smiraglia paolo.smiraglia at gmail.com
Fri May 28 11:33:49 UTC 2010


I'm working on hooks mechanism. When I try to add some field in enum

    virHookQemuOp

make command return me error

    $ util/hooks.c:***: error: negative width in bit-field
'verify_error_if_negative_size__'

I think the error is caused by a little programming error in

   /src/util/hooks.c:74

where the struct virHookLxcOp is allocated by macro VIR_ENUM_IMPL with
dimension VIR_HOOK_QEMU_OP_LAST and not with VIR_HOOK_LXC_OP_LAST.

A possible solution could be to apply the patch listed below.


diff --git a/libvirt-20100528/src/util/hooks.c
b/libvirt-20100528-pmchook/src/util/hooks.c
index dec9223..482480d 100644
--- a/libvirt-20100528/src/util/hooks.c
+++ b/libvirt-20100528-pmchook/src/util/hooks.c
@@ -71,7 +71,7 @@ VIR_ENUM_IMPL(virHookQemuOp, VIR_HOOK_QEMU_OP_LAST,
               "start",
               "stopped")

-VIR_ENUM_IMPL(virHookLxcOp, VIR_HOOK_QEMU_OP_LAST,
+VIR_ENUM_IMPL(virHookLxcOp, VIR_HOOK_LXC_OP_LAST,
               "start",
               "stopped")



Have a good day.....



-- 
PAOLO SMIRAGLIA
http://portale.isf.polito.it/paolo-smiraglia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hooks.c.patch
Type: text/x-patch
Size: 486 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100528/f6372da6/attachment-0001.bin>


More information about the libvir-list mailing list