[Libguestfs] [PATCH 1/5] macosx: Add required third parameter for xdrproc_t callbacks

Margaret Lewicka margaret at meaningless.name
Mon Feb 9 11:06:15 UTC 2015


>From Apple's xdr.h:
"If your code invokes an xdrproc_t callback, it must be modified to pass
a third parameter, which may simply be zero."
---
 src/proto.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/proto.c b/src/proto.c
index 92ae84d..57f4882 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -252,7 +252,12 @@ guestfs___send (guestfs_h *g, int proc_nr,
    * have no parameters.
    */
   if (xdrp) {
+#if !(defined __APPLE__ && defined __MACH__)
     if (!(*xdrp) (&xdr, args)) {
+#else
+    /* Mac OS X's implementation of xdrproc_t requires a third parameter */
+    if (!(*xdrp) (&xdr, args, 0)) {
+#endif
       error (g, _("dispatch failed to marshal args"));
       return -1;
     }
@@ -681,7 +686,12 @@ guestfs___recv (guestfs_h *g, const char *fn,
       return -1;
     }
   } else {
+#if !(defined __APPLE__ && defined __MACH__)
     if (xdrp && ret && !xdrp (&xdr, ret)) {
+#else
+    /* Mac OS X's implementation of xdrproc_t requires a third parameter */
+    if (xdrp && ret && !xdrp (&xdr, ret, 0)) {
+#endif
       error (g, "%s: failed to parse reply", fn);
       xdr_destroy (&xdr);
       return -1;
-- 
1.9.3




More information about the Libguestfs mailing list