From db79966c497a4b7936f28a5d87a54f56c52b76e5 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 5 Jul 2002 21:39:33 +0000 Subject: [PATCH] * port-sockets.h (SOCKET_WRITEV) [!_WIN32]: Use TMP after setting it, to silence compiler warnings git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14606 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/ChangeLog | 5 +++++ src/include/configure.in | 16 +++++++++++++++- src/include/fake-addrinfo.h | 10 ++++++---- src/include/port-sockets.h | 2 +- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/include/ChangeLog b/src/include/ChangeLog index a972daf05..30e24b142 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,8 @@ +2002-07-05 Ken Raeburn + + * port-sockets.h (SOCKET_WRITEV) [!_WIN32]: Use TMP after setting + it, to silence compiler warnings. + 2002-06-26 Ezra Peisach * configure.in: Modify test for in6addr_any definition in C diff --git a/src/include/configure.in b/src/include/configure.in index 9c9199e7e..7413bb039 100644 --- a/src/include/configure.in +++ b/src/include/configure.in @@ -5,10 +5,12 @@ AC_PROG_INSTALL AC_PROG_AWK AC_PROG_LEX AC_C_CONST -AC_CHECK_FUNCS(strdup labs setvbuf memmove bcopy inet_ntoa inet_aton gethostbyname_r gethostbyaddr_r getservbyname_r getservbyport_r seteuid setresuid setreuid setegid setresgid setregid) +AC_CHECK_FUNCS(strdup labs setvbuf memmove bcopy inet_ntoa inet_aton seteuid setresuid setreuid setegid setresgid setregid) dnl dnl Check what the return types for gethostbyname_r and getservbyname_r are. dnl +AC_CHECK_FUNC(gethostbyname_r,[ +ac_cv_func_gethostbyname_r=yes if test "$ac_cv_func_gethostbyname_r" = yes; then AC_MSG_CHECKING([if gethostbyname_r returns an int]) AC_CACHE_VAL(krb5_cv_gethostbyname_r_returns_int, @@ -34,7 +36,14 @@ if test "$ac_cv_func_gethostbyname_r" = yes; then AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns int rather than struct hostent * ]) fi fi +if test "$ac_cv_func_gethostbyname_r" = yes; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1, [Define if gethostbyname_r exists and its return type is known]) + AC_CHECK_FUNC(gethostbyaddr_r) +fi +]) dnl +AC_CHECK_FUNC(getservbyname_r,[ +ac_cv_func_getservbyname_r=yes if test "$ac_cv_func_getservbyname_r" = yes; then AC_MSG_CHECKING([if getservbyname_r returns an int]) AC_CACHE_VAL(krb5_cv_getservbyname_r_returns_int, @@ -60,6 +69,11 @@ if test "$ac_cv_func_getservbyname_r" = yes; then AC_DEFINE(GETSERVBYNAME_R_RETURNS_INT, 1, [Define if getservbyname_r returns int rather than struct servent * ]) fi fi +if test "$ac_cv_func_getservbyname_r" = yes; then + AC_DEFINE(HAVE_GETSERVBYNAME_R, 1, [Define if getservbyname_r exists and its return type is known]) + AC_CHECK_FUNC(getservbyport_r) +fi +]) dnl HAVE_YYLINENO CHECK_DIRENT diff --git a/src/include/fake-addrinfo.h b/src/include/fake-addrinfo.h index c5083bcd7..8d80b5b32 100644 --- a/src/include/fake-addrinfo.h +++ b/src/include/fake-addrinfo.h @@ -128,8 +128,8 @@ gai_strerror (int code) /*@*/; #endif #ifdef _WIN32 -#define HAVE_GETADDRINFO -#define HAVE_GETNAMEINFO +#define HAVE_GETADDRINFO 1 +#define HAVE_GETNAMEINFO 1 #endif @@ -379,7 +379,7 @@ int getnameinfo (const struct sockaddr *addr, socklen_t len, #define HAVE_FAKE_GETADDRINFO /* was not originally HAVE_GETADDRINFO */ #define HAVE_GETADDRINFO #undef HAVE_GETNAMEINFO -#define HAVE_GETNAMEINFO +#define HAVE_GETNAMEINFO 1 static char *gai_strerror (int code); @@ -417,6 +417,7 @@ char *gai_strerror (int code); #endif #ifdef NEED_FAKE_GETADDRINFO +#include /* for strspn */ static inline int translate_h_errno (int h); @@ -623,7 +624,8 @@ fake_getnameinfo (const struct sockaddr *sa, socklen_t len, #endif } else { int herr; - GET_HOST_BY_ADDR(&sinp->sin_addr, sizeof (struct in_addr), + GET_HOST_BY_ADDR((const char *) &sinp->sin_addr, + sizeof (struct in_addr), sa->sa_family, hp, herr); if (hp == 0) { if (herr == NO_ADDRESS && !(flags & NI_NAMEREQD)) /* ??? */ diff --git a/src/include/port-sockets.h b/src/include/port-sockets.h index 7c3ed1a91..5dc936af9 100644 --- a/src/include/port-sockets.h +++ b/src/include/port-sockets.h @@ -119,7 +119,7 @@ typedef struct iovec sg_buf; /* Use TMP to avoid compiler warnings and keep things consistent with Windoze version. */ #define SOCKET_WRITEV(FD, SG, LEN, TMP) \ - ((TMP) = writev((FD), (SG), (LEN))) + ((TMP) = writev((FD), (SG), (LEN)), (TMP)) #define SHUTDOWN_READ 0 #define SHUTDOWN_WRITE 1 -- 2.26.2