diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-10 07:38:56 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-10 07:38:56 +0000 |
commit | c85e616e29482200cd0a47fa6c85165a98a4caaf (patch) | |
tree | 968c93f62ac9ce060c59926d75ff4e4946b771c6 /lib/libc | |
parent | dcd31244e8ecc492a511e48ed4c631615e092491 (diff) | |
download | FreeBSD-src-c85e616e29482200cd0a47fa6c85165a98a4caaf.zip FreeBSD-src-c85e616e29482200cd0a47fa6c85165a98a4caaf.tar.gz |
MFhead @ r292053
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/rpc/svc_vc.c | 18 | ||||
-rw-r--r-- | lib/libc/stdio/open_memstream.c | 4 | ||||
-rw-r--r-- | lib/libc/stdio/open_wmemstream.c | 4 |
3 files changed, 20 insertions, 6 deletions
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c index bafb725..e81a839 100644 --- a/lib/libc/rpc/svc_vc.c +++ b/lib/libc/rpc/svc_vc.c @@ -281,8 +281,8 @@ rendezvous_request(SVCXPRT *xprt, struct rpc_msg *msg) int sock, flags; struct cf_rendezvous *r; struct cf_conn *cd; - struct sockaddr_storage addr; - socklen_t len; + struct sockaddr_storage addr, sslocal; + socklen_t len, slen; struct __rpc_sockinfo si; SVCXPRT *newxprt; fd_set cleanfds; @@ -347,6 +347,20 @@ again: __xdrrec_setnonblock(&cd->xdrs, cd->maxrec); } else cd->nonblock = FALSE; + slen = sizeof(struct sockaddr_storage); + if(_getsockname(sock, (struct sockaddr *)(void *)&sslocal, &slen) < 0) { + warnx("svc_vc_create: could not retrieve local addr"); + newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0; + } else { + newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = sslocal.ss_len; + newxprt->xp_ltaddr.buf = mem_alloc((size_t)sslocal.ss_len); + if (newxprt->xp_ltaddr.buf == NULL) { + warnx("svc_vc_create: no mem for local addr"); + newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0; + } else { + memcpy(newxprt->xp_ltaddr.buf, &sslocal, (size_t)sslocal.ss_len); + } + } gettimeofday(&cd->last_recv_time, NULL); diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c index f3d1ee5..a7e0bae 100644 --- a/lib/libc/stdio/open_memstream.c +++ b/lib/libc/stdio/open_memstream.c @@ -31,10 +31,10 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include <assert.h> #include <errno.h> +#include <limits.h> #ifdef DEBUG -#include <inttypes.h> +#include <stdint.h> #endif -#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/lib/libc/stdio/open_wmemstream.c b/lib/libc/stdio/open_wmemstream.c index 4585531..3e8713f 100644 --- a/lib/libc/stdio/open_wmemstream.c +++ b/lib/libc/stdio/open_wmemstream.c @@ -31,10 +31,10 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include <assert.h> #include <errno.h> +#include <limits.h> #ifdef DEBUG -#include <inttypes.h> +#include <stdint.h> #endif -#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> |