1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Fix emission of domain events messages

The code which updated the message length after writing the
payload wrote the updated length word in the wrong place since
the XDR object was given a buffer pointing to the start of the
header payload, rather than message start.

* daemon/remote.c: Fix updating of event message length so that
  we actually send the payload, not just the header
This commit is contained in:
Daniel P. Berrange 2009-09-30 14:33:05 +01:00
parent 96ad9ed33b
commit 398d01b8a9

View File

@ -4745,17 +4745,19 @@ remoteDispatchDomainEventSend (struct qemud_client *client,
/* Serialise the return header and event. */
xdrmem_create (&xdr,
msg->buffer + msg->bufferOffset,
msg->bufferLength - msg->bufferOffset,
msg->buffer,
msg->bufferLength,
XDR_ENCODE);
/* Skip over the header we just wrote */
if (xdr_setpos (&xdr, msg->bufferOffset) == 0)
goto xdr_error;
if (!xdr_remote_domain_event_msg(&xdr, data))
goto xdr_error;
/* Update length word */
msg->bufferOffset += xdr_getpos (&xdr);
len = msg->bufferOffset;
/* Update length word to include payload*/
len = msg->bufferOffset = xdr_getpos (&xdr);
if (xdr_setpos (&xdr, 0) == 0)
goto xdr_error;