[Pkg-libvirt-commits] [libguestfs] 13/72: lib: Add third, zero parameter to xdrproc_t

Hilko Bengen bengen at moszumanska.debian.org
Sun Apr 5 15:19:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit 67459bfa85a09bbad9e168aa272514e5a6d60d32
Author: Margaret Lewicka <margaret at meaningless.name>
Date:   Thu Feb 12 17:28:48 2015 +0000

    lib: Add third, zero parameter to xdrproc_t
    
    As advised by Daniel P. Berrange, the third parameter can be passed on all
    platforms rather than specifically Mac.
    
    Quoting a libvirt commit rationale after Daniel:
    
     commit 9fa3a8ab6fd82ad2f5a14b490696085061418718
     Author: Doug Goldstein <cardoe at cardoe.com>
     Date:   Wed Oct 30 11:22:58 2013 -0500
    
       MacOS: Handle changes to xdrproc_t definition
    
       With Mac OS X 10.9, xdrproc_t is no longer defined as:
    
       typedef bool_t (*xdrproc_t)(XDR *, ...);
    
       but instead as:
    
       typedef 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.
    
    (cherry picked from commit e39ab27deaf1e124c4078db18fe883ad339c865b)
---
 src/proto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/proto.c b/src/proto.c
index 8001c8c..53d1d6b 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -252,7 +252,7 @@ guestfs___send (guestfs_h *g, int proc_nr,
    * have no parameters.
    */
   if (xdrp) {
-    if (!(*xdrp) (&xdr, args)) {
+    if (!(*xdrp) (&xdr, args, 0)) {
       error (g, _("dispatch failed to marshal args"));
       return -1;
     }
@@ -681,7 +681,7 @@ guestfs___recv (guestfs_h *g, const char *fn,
       return -1;
     }
   } else {
-    if (xdrp && ret && !xdrp (&xdr, ret)) {
+    if (xdrp && ret && !xdrp (&xdr, ret, 0)) {
       error (g, "%s: failed to parse reply", fn);
       xdr_destroy (&xdr);
       return -1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list