]> xenbits.xensource.com Git - libvirt.git/commitdiff
MacOS: Handle changes to xdrproc_t definition
authorDoug Goldstein <cardoe@cardoe.com>
Wed, 30 Oct 2013 16:22:58 +0000 (11:22 -0500)
committerDoug Goldstein <cardoe@cardoe.com>
Sun, 3 Nov 2013 15:34:10 +0000 (09:34 -0600)
With Mac OS X 10.9, xdrproc_t is no longer defined as:

typedef bool_t (*xdrproc_t)(XDR *, ...);

but instead as:

typdef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);

For reference, Linux systems typically define it as:

typedef bool_t (*xdrproc_t)(XDR *, void *, ...);

The rationale explained in the header is that using a vararg is
incorrect and has a potential to change the ABI slightly do to compiler
optimizations taken and the undefined behavior. They decided
to specify the exact number of parameters and for compatibility with old
code decided to make the signature require 3 arguments. The third
argument is ignored for cases that its not used and its recommended to
supply a 0.

src/rpc/virnetmessage.c

index d60366bde4e77f1ca3e75f882178522f85b6e8cd..af074047ff78fd69565bbb050375498bbecbeb9a 100644 (file)
@@ -345,7 +345,7 @@ int virNetMessageEncodePayload(virNetMessagePtr msg,
                   msg->bufferLength - msg->bufferOffset, XDR_ENCODE);
 
     /* Try to encode the payload. If the buffer is too small increase it. */
-    while (!(*filter)(&xdr, data)) {
+    while (!(*filter)(&xdr, data, 0)) {
         unsigned int newlen = (msg->bufferLength - VIR_NET_MESSAGE_LEN_MAX) * 4;
 
         if (newlen > VIR_NET_MESSAGE_MAX) {
@@ -402,7 +402,7 @@ int virNetMessageDecodePayload(virNetMessagePtr msg,
     xdrmem_create(&xdr, msg->buffer + msg->bufferOffset,
                   msg->bufferLength - msg->bufferOffset, XDR_DECODE);
 
-    if (!(*filter)(&xdr, data)) {
+    if (!(*filter)(&xdr, data, 0)) {
         virReportError(VIR_ERR_RPC, "%s", _("Unable to decode message payload"));
         goto error;
     }