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

Pino Toscano ptoscano at redhat.com
Mon Feb 9 12:39:55 UTC 2015


On Monday 09 February 2015 11:06:15 Margaret Lewicka wrote:
> >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;

This should rather be a configure check, instead of hardcoding how a
libc behaves.

Also, what does the third parameter represent?

-- 
Pino Toscano




More information about the Libguestfs mailing list