From 59af05207fc62019ab17b58518f02d52bd414ef9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 29 Jan 2006 16:17:19 +0000 Subject: sync with glibc and rename local socket var to _socket --- libc/inet/rpc/pmap_rmt.c | 71 ++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 35 deletions(-) (limited to 'libc/inet/rpc/pmap_rmt.c') diff --git a/libc/inet/rpc/pmap_rmt.c b/libc/inet/rpc/pmap_rmt.c index 97e6be4b4..badb6a467 100644 --- a/libc/inet/rpc/pmap_rmt.c +++ b/libc/inet/rpc/pmap_rmt.c @@ -86,38 +86,6 @@ extern u_long _create_xid (void) attribute_hidden; static const struct timeval timeout = {3, 0}; -/* - * XDR remote call arguments - * written for XDR_ENCODE direction only - */ -libc_hidden_proto(xdr_rmtcall_args) -bool_t -xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) -{ - u_int lenposition, argposition, position; - - if (xdr_u_long (xdrs, &(cap->prog)) && - xdr_u_long (xdrs, &(cap->vers)) && - xdr_u_long (xdrs, &(cap->proc))) - { - lenposition = XDR_GETPOS (xdrs); - if (!xdr_u_long (xdrs, &(cap->arglen))) - return FALSE; - argposition = XDR_GETPOS (xdrs); - if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) - return FALSE; - position = XDR_GETPOS (xdrs); - cap->arglen = (u_long) position - (u_long) argposition; - XDR_SETPOS (xdrs, lenposition); - if (!xdr_u_long (xdrs, &(cap->arglen))) - return FALSE; - XDR_SETPOS (xdrs, position); - return TRUE; - } - return FALSE; -} -libc_hidden_def(xdr_rmtcall_args) - /* * pmapper remote-call-service interface. * This routine is used to call the pmapper remote call service @@ -134,14 +102,14 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p struct timeval tout; u_long *port_ptr; { - int socket = -1; + int _socket = -1; CLIENT *client; struct rmtcallargs a; struct rmtcallres r; enum clnt_stat stat; addr->sin_port = htons (PMAPPORT); - client = clntudp_create (addr, PMAPPROG, PMAPVERS, timeout, &socket); + client = clntudp_create (addr, PMAPPROG, PMAPVERS, timeout, &_socket); if (client != (CLIENT *) NULL) { a.prog = prog; @@ -161,12 +129,45 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p { stat = RPC_FAILED; } - /* (void)close(socket); CLNT_DESTROY already closed it */ + /* (void)close(_socket); CLNT_DESTROY already closed it */ addr->sin_port = 0; return stat; } +/* + * XDR remote call arguments + * written for XDR_ENCODE direction only + */ +libc_hidden_proto(xdr_rmtcall_args) +bool_t +xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) +{ + u_int lenposition, argposition, position; + + if (xdr_u_long (xdrs, &(cap->prog)) && + xdr_u_long (xdrs, &(cap->vers)) && + xdr_u_long (xdrs, &(cap->proc))) + { + u_long dummy_arglen = 0; + lenposition = XDR_GETPOS (xdrs); + if (!xdr_u_long (xdrs, &dummy_arglen)) + return FALSE; + argposition = XDR_GETPOS (xdrs); + if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) + return FALSE; + position = XDR_GETPOS (xdrs); + cap->arglen = (u_long) position - (u_long) argposition; + XDR_SETPOS (xdrs, lenposition); + if (!xdr_u_long (xdrs, &(cap->arglen))) + return FALSE; + XDR_SETPOS (xdrs, position); + return TRUE; + } + return FALSE; +} +libc_hidden_def(xdr_rmtcall_args) + /* * XDR remote call results * written for XDR_DECODE direction only -- cgit v1.2.3