diff --git a/Makefile.in b/Makefile.in index 91568251f1..30bdc04e03 100644 --- a/Makefile.in +++ b/Makefile.in @@ -17,6 +17,8 @@ DISTFILES = Makefile.in config.h.in configure.in \ distclean:: FORCE rm -f config.cache config.h config.log config.status +cleandir: distclean + kit: kitclean mkdir bind-${VERSION} @(cd bind-${VERSION}; for i in ${DISTFILES}; do ln -s ../$$i $$i; done) diff --git a/acconfig.h b/acconfig.h index 88f96eefb5..569d6a08b8 100644 --- a/acconfig.h +++ b/acconfig.h @@ -9,8 +9,3 @@ /* define if you need AF_INET6 */ #undef NEED_AF_INET6 - -/* Probably not the right place... */ -#ifdef NEED_AF_INET6 -#define AF_INET6 99 -#endif diff --git a/config.h.in b/config.h.in index db63f642d0..40a81f73c5 100644 --- a/config.h.in +++ b/config.h.in @@ -27,11 +27,6 @@ /* define if you need AF_INET6 */ #undef NEED_AF_INET6 -/* Probably not the right place... */ -#ifdef NEED_AF_INET6 -#define AF_INET6 99 -#endif - /* Define if you have the header file. */ #undef HAVE_FCNTL_H diff --git a/configure b/configure index 80f36ac0b0..a65b5b4068 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.13 +# From configure.in Revision: 1.14 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.12 @@ -1289,8 +1289,13 @@ fi fi -echo $ac_n "checking for socket in -lxnet""... $ac_c" 1>&6 -echo "configure:1294: checking for socket in -lxnet" >&5 + +case "$host" in + mips-sgi-irix*) + ;; + *) + echo $ac_n "checking for socket in -lxnet""... $ac_c" 1>&6 +echo "configure:1299: checking for socket in -lxnet" >&5 ac_lib_var=`echo xnet'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1298,7 +1303,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lxnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1335,7 +1340,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1339: checking for socket in -lsocket" >&5 +echo "configure:1344: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1343,7 +1348,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1381,8 +1386,8 @@ else echo "$ac_t""no" 1>&6 fi - echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 -echo "configure:1386: checking for inet_ntoa in -lnsl" >&5 + echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 +echo "configure:1391: checking for inet_ntoa in -lnsl" >&5 ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1390,7 +1395,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1428,17 +1433,19 @@ else echo "$ac_t""no" 1>&6 fi - + fi + ;; +esac echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6 -echo "configure:1437: checking for inet_ntop" >&5 +echo "configure:1444: checking for inet_ntop" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_ntop'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_ntop=yes" else @@ -1488,12 +1495,12 @@ EOF fi echo $ac_n "checking for inet_pton""... $ac_c" 1>&6 -echo "configure:1492: checking for inet_pton" >&5 +echo "configure:1499: checking for inet_pton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_pton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_pton=yes" else @@ -1543,12 +1550,12 @@ EOF fi echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:1547: checking for inet_aton" >&5 +echo "configure:1554: checking for inet_aton" >&5 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -1599,7 +1606,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1603: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1610: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1628,7 +1635,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1632: checking for $ac_word" >&5 +echo "configure:1639: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1665,7 +1672,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1669: checking for a BSD compatible install" >&5 +echo "configure:1676: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1715,22 +1722,20 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +STD_CINCLUDES="" +STD_CDEFINES="" +STD_CWARNINGS="" if test "X$GCC" = "Xyes"; then - STD_CINCLUDES= - STD_CDEFINES= - STD_CWARNINGS="-W -Wall -Wmissing-prototypes" + STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes" case "$host" in *-sun-solaris*) LIBS="$LIBS -lthread" ;; esac else - STD_CINCLUDES= - STD_CDEFINES= - STD_CWARNINGS= case "$host" in *-dec-osf*) CC="$CC -pthread" @@ -1743,23 +1748,32 @@ else ;; esac fi + case "$host" in + *-dec-osf*) + STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=size_t" + ;; *-sun-solaris*) cat >> confdefs.h <<\EOF #define NEED_AF_INET6 1 EOF + STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=int" ;; *-hp-hpux*) cat >> confdefs.h <<\EOF #define NEED_AF_INET6 1 EOF + STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=int" + ;; + *) + STD_CDEFINES="$STD_CDEFINES -DISC_SOCKADDR_LEN_T=int" ;; esac -BIND9_MAKE_RULES=make/rules +BIND9_MAKE_RULES=$srcdir/make/rules BIND9_VERSION=$srcdir/version diff --git a/configure.in b/configure.in index 5c2fd58504..f568bdfa3d 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ -AC_REVISION($Revision: 1.14 $) +AC_REVISION($Revision: 1.15 $) AC_INIT(lib/dns/name.c) AC_CONFIG_HEADER(config.h) @@ -45,10 +45,22 @@ AC_CHECK_LIB(pthread, pthread_create,, AC_CHECK_LIB(pthread, __pthread_create) AC_CHECK_LIB(pthread, __pthread_create_system) ) -AC_CHECK_LIB(xnet, socket,, - AC_CHECK_LIB(socket, socket) - AC_CHECK_LIB(nsl, inet_ntoa) -) + +dnl +dnl The wonderful thing about standards is there are so many to choose from... +dnl +dnl Under IRIX (6.5 at least) -lxnet buys us nothign but compiler warnings. +dnl +case "$host" in + mips-sgi-irix*) + ;; + *) + AC_CHECK_LIB(xnet, socket, , + AC_CHECK_LIB(socket, socket) + AC_CHECK_LIB(nsl, inet_ntoa) + ) + ;; +esac AC_CHECK_FUNC(inet_ntop, , [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS inet_ntop.o" @@ -70,22 +82,20 @@ AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_INSTALL +STD_CINCLUDES="" +STD_CDEFINES="" +STD_CWARNINGS="" AC_SUBST(STD_CINCLUDES) AC_SUBST(STD_CDEFINES) AC_SUBST(STD_CWARNINGS) if test "X$GCC" = "Xyes"; then - STD_CINCLUDES= - STD_CDEFINES= - STD_CWARNINGS="-W -Wall -Wmissing-prototypes" + STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes" case "$host" in *-sun-solaris*) LIBS="$LIBS -lthread" ;; esac else - STD_CINCLUDES= - STD_CDEFINES= - STD_CWARNINGS= case "$host" in *-dec-osf*) CC="$CC -pthread" @@ -98,6 +108,10 @@ else ;; esac fi + +dnl +dnl Networking specifics. +dnl case "$host" in *-sun-solaris*) AC_DEFINE(NEED_AF_INET6) @@ -108,7 +122,7 @@ case "$host" in esac AC_SUBST_FILE(BIND9_MAKE_RULES) -BIND9_MAKE_RULES=make/rules +BIND9_MAKE_RULES=$srcdir/make/rules AC_SUBST_FILE(BIND9_VERSION) BIND9_VERSION=$srcdir/version diff --git a/lib/isc/include/isc/inet.h b/lib/isc/include/isc/inet.h index 4e14ba4ddd..e58710236a 100644 --- a/lib/isc/include/isc/inet.h +++ b/lib/isc/include/isc/inet.h @@ -27,15 +27,18 @@ * controlled tree. */ +#ifdef NEED_AF_INET6 +#define AF_INET6 99 +#endif + #ifdef NEED_INET_NTOP -char *isc_inet_ntop(int af, const void *src, char *dst, size_t size); +const char *isc_inet_ntop(int af, const void *src, char *dst, size_t size); #else #define isc_inet_ntop inet_ntop #endif #ifdef NEED_INET_PTON -int -isc_inet_pton(int af, const char *src, void *dst); +int isc_inet_pton(int af, const char *src, void *dst); #else #define isc_inet_pton inet_pton #endif diff --git a/lib/isc/inet_aton.c b/lib/isc/inet_aton.c index 410e50c7b8..b332d56d3b 100644 --- a/lib/isc/inet_aton.c +++ b/lib/isc/inet_aton.c @@ -70,9 +70,11 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static char rcsid[] = "$Id: inet_aton.c,v 1.2 1999/02/06 01:51:36 halley Exp $"; +static char rcsid[] = "$Id: inet_aton.c,v 1.3 1999/02/06 08:48:07 explorer Exp $"; #endif /* LIBC_SCCS and not lint */ +#include + #include #include @@ -82,6 +84,7 @@ static char rcsid[] = "$Id: inet_aton.c,v 1.2 1999/02/06 01:51:36 halley Exp $"; #include #include +#include /* * Check whether "cp" is a valid ascii representation diff --git a/lib/isc/inet_ntop.c b/lib/isc/inet_ntop.c index 4fcaf0affa..0fb0fde52f 100644 --- a/lib/isc/inet_ntop.c +++ b/lib/isc/inet_ntop.c @@ -16,9 +16,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/01/30 04:27:48 explorer Exp $"; +static char rcsid[] = "$Id: inet_ntop.c,v 1.3 1999/02/06 08:48:07 explorer Exp $"; #endif /* LIBC_SCCS and not lint */ +#include + #include #include #include @@ -28,9 +30,12 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/01/30 04:27:48 explorer Exp $ #include #include + #include #include +#include + #define NS_INT16SZ 2 #define NS_IN6ADDRSZ 16 @@ -39,9 +44,9 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/01/30 04:27:48 explorer Exp $ * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. */ -static const char *isc_inet_ntop4(const u_char *src, char *dst, size_t size); +static const char *isc_inet_ntop4(const unsigned char *src, char *dst, size_t size); #ifdef AF_INET6 -static const char *isc_inet_ntop6(const u_char *src, char *dst, size_t size); +static const char *isc_inet_ntop6(const unsigned char *src, char *dst, size_t size); #endif /* char * @@ -76,12 +81,12 @@ isc_inet_ntop(int af, const void *src, char *dst, size_t size) * `dst' (as a const) * notes: * (1) uses no statics - * (2) takes a u_char* not an in_addr as input + * (2) takes a unsigned char* not an in_addr as input * author: * Paul Vixie, 1996. */ static const char * -isc_inet_ntop4(const u_char *src, char *dst, size_t size) +isc_inet_ntop4(const unsigned char *src, char *dst, size_t size) { static const char *fmt = "%u.%u.%u.%u"; char tmp[sizeof "255.255.255.255"]; @@ -103,7 +108,7 @@ isc_inet_ntop4(const u_char *src, char *dst, size_t size) */ #ifdef AF_INET6 static const char * -isc_inet_ntop6(const u_char *src, char *dst, size_t size) +isc_inet_ntop6(const unsigned char *src, char *dst, size_t size) { /* * Note that int32_t and int16_t need only be "at least" large enough @@ -114,7 +119,7 @@ isc_inet_ntop6(const u_char *src, char *dst, size_t size) */ char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; struct { int base, len; } best, cur; - u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; + unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ]; int i; /* diff --git a/lib/isc/inet_pton.c b/lib/isc/inet_pton.c index 65e4ba1d93..44251f1f43 100644 --- a/lib/isc/inet_pton.c +++ b/lib/isc/inet_pton.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/02/02 00:37:09 halley Exp $"; +static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/02/06 08:48:07 explorer Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -25,11 +25,15 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/02/02 00:37:09 halley Exp $"; #include #include + #include #include + #include #include +#include + #define NS_INT16SZ 2 #define NS_INADDRSZ 4 #define NS_IN6ADDRSZ 16 @@ -39,8 +43,8 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/02/02 00:37:09 halley Exp $"; * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. */ -static int inet_pton4(const char *src, u_char *dst); -static int inet_pton6(const char *src, u_char *dst); +static int inet_pton4(const char *src, unsigned char *dst); +static int inet_pton6(const char *src, unsigned char *dst); /* int * isc_inet_pton(af, src, dst) @@ -84,11 +88,11 @@ isc_inet_pton(af, src, dst) static int inet_pton4(src, dst) const char *src; - u_char *dst; + unsigned char *dst; { static const char digits[] = "0123456789"; int saw_digit, octets, ch; - u_char tmp[NS_INADDRSZ], *tp; + unsigned char tmp[NS_INADDRSZ], *tp; saw_digit = 0; octets = 0; @@ -97,7 +101,7 @@ inet_pton4(src, dst) const char *pch; if ((pch = strchr(digits, ch)) != NULL) { - u_int new = *tp * 10 + (pch - digits); + unsigned int new = *tp * 10 + (pch - digits); if (new > 255) return (0); @@ -137,14 +141,14 @@ inet_pton4(src, dst) static int inet_pton6(src, dst) const char *src; - u_char *dst; + unsigned char *dst; { static const char xdigits_l[] = "0123456789abcdef", xdigits_u[] = "0123456789ABCDEF"; - u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; const char *xdigits, *curtok; int ch, saw_xdigit; - u_int val; + unsigned int val; memset((tp = tmp), '\0', NS_IN6ADDRSZ); endp = tp + NS_IN6ADDRSZ; @@ -179,8 +183,8 @@ inet_pton6(src, dst) } if (tp + NS_INT16SZ > endp) return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; saw_xdigit = 0; val = 0; continue; @@ -196,8 +200,8 @@ inet_pton6(src, dst) if (saw_xdigit) { if (tp + NS_INT16SZ > endp) return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; } if (colonp != NULL) { /* diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 6d39cf9335..f27d6cbafd 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -36,6 +36,9 @@ #include "util.h" +/* temp hack! XXX */ +#define ISC_SOCKADDR_LEN_T int + #ifndef _WIN32 #define WINAPI /* we're not windows */ #endif @@ -718,7 +721,7 @@ internal_accept(isc_task_t *task, isc_event_t *ev) isc_socket_newconnev_t *dev; ncintev_t *iev; struct sockaddr addr; - u_int addrlen; + ISC_SOCKADDR_LEN_T addrlen; int fd; isc_result_t result = ISC_R_SUCCESS; @@ -841,7 +844,7 @@ internal_recv(isc_task_t *task, isc_event_t *ev) int cc; size_t read_count; struct sockaddr addr; - u_int addrlen; + ISC_SOCKADDR_LEN_T addrlen; /* * Find out what socket this is and lock it. @@ -1634,11 +1637,14 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, */ if (EMPTY(sock->recv_list)) { if (sock->type == isc_socket_udp) { + ISC_SOCKADDR_LEN_T addrlen; ev->addrlength = sizeof(isc_sockaddr_t); + addrlen = (ISC_SOCKADDR_LEN_T)ev->addrlength; cc = recvfrom(sock->fd, ev->region.base, ev->region.length, 0, (struct sockaddr *)&ev->address, - &ev->addrlength); + &addrlen); + ev->addrlength = (unsigned int)addrlen; } else { cc = recv(sock->fd, ev->region.base, ev->region.length, 0); @@ -1734,13 +1740,14 @@ isc_socket_send(isc_socket_t *sock, isc_region_t *region, isc_result_t isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, void *arg, - isc_sockaddr_t *address, unsigned int addrlength) + isc_sockaddr_t *address, unsigned int addrlen) { isc_socketevent_t *ev; rwintev_t *iev; isc_socketmgr_t *manager; isc_task_t *ntask = NULL; int cc; + ISC_SOCKADDR_LEN_T addrlength = (ISC_SOCKADDR_LEN_T)addrlen; REQUIRE(VALID_SOCKET(sock)); @@ -2188,7 +2195,7 @@ internal_connect(isc_task_t *task, isc_event_t *ev) isc_socket_connev_t *dev; cnintev_t *iev; int cc; - int optlen; + ISC_SOCKADDR_LEN_T optlen; sock = ev->sender; iev = (cnintev_t *)ev; @@ -2302,7 +2309,7 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp, int *lengthp) { isc_sockaddr_t addr; - int len; + ISC_SOCKADDR_LEN_T len; REQUIRE(VALID_SOCKET(sock)); REQUIRE(addressp != NULL); @@ -2318,13 +2325,13 @@ isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp, return (ISC_R_UNEXPECTED); } - if (*lengthp < sock->addrlength) { + if ((unsigned int)*lengthp < (unsigned int)len) { UNLOCK(&sock->lock); return (ISC_R_NOSPACE); } - memcpy(addressp, &sock->address, (size_t)sock->addrlength); - *lengthp = sock->addrlength; + memcpy(addressp, &sock->address, (size_t)len); + *lengthp = (unsigned int)len; UNLOCK(&sock->lock);