]> xenbits.xensource.com Git - libvirt.git/commitdiff
Ensure remote daemon unions are always non-zero length
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 19 Aug 2010 13:32:10 +0000 (14:32 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 10 Sep 2010 10:14:51 +0000 (11:14 +0100)
If the remote daemon args/ret unions ever become zero length
(due to a build / Makefile bug) then bad stuff happens at
runtime. Add a compile time assertion to check for this kind
of problem

* daemon/remote.h: Ensure non-zero length unions

daemon/remote.h

index fd8d3814a87142a315aa04a6e85961293f1ca851..1eb83865cb8da8e1ab4093104238be2c81e0eb09 100644 (file)
 typedef union {
 # include "remote_dispatch_args.h"
 } dispatch_args;
+verify(sizeof(dispatch_args) > 0);
 
 typedef union {
 # include "remote_dispatch_ret.h"
 } dispatch_ret;
+verify(sizeof(dispatch_ret) > 0);
 
 typedef union {
 # include "qemu_dispatch_args.h"
 } qemu_dispatch_args;
+verify(sizeof(qemu_dispatch_args) > 0);
 
 typedef union {
 # include "qemu_dispatch_ret.h"
 } qemu_dispatch_ret;
+verify(sizeof(qemu_dispatch_ret) > 0);