diff --git a/configure b/configure index 4f1a4a8c626..87207cb5fa2 100755 --- a/configure +++ b/configure @@ -6840,9 +6840,9 @@ EOF fi -echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6 -echo "configure:6845: checking "for sun_len in struct sockaddr_un"" >&5 -if eval "test \"`echo '$''{'ac_cv_c_sun_len'+set}'`\" = set"; then +echo $ac_n "checking "for sa_len in struct sockaddr"""... $ac_c" 1>&6 +echo "configure:6845: checking "for sa_len in struct sockaddr"" >&5 +if eval "test \"`echo '$''{'ac_cv_c_sockaddr_sa_len'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include + +int main() { +static struct sockaddr addr; addr.sa_len = 1 +; return 0; } +EOF +if { (eval echo configure:6859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_sockaddr_sa_len="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_sockaddr_sa_len="no" +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_sockaddr_sa_len" 1>&6 +if test "$ac_cv_c_sockaddr_sa_len" = "yes" +then + cat >> confdefs.h <<\EOF +#define HAVE_SOCKADDR_SA_LEN 1 +EOF + +fi + + +echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6 +echo "configure:6882: checking "for sun_len in struct sockaddr_un"" >&5 +if eval "test \"`echo '$''{'ac_cv_c_sockaddr_sun_len'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include #include int main() { static struct sockaddr_un addr; addr.sun_len = 1 ; return 0; } EOF -if { (eval echo configure:6859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_c_sun_len="yes" + ac_cv_c_sockaddr_sun_len="yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_c_sun_len="no" + ac_cv_c_sockaddr_sun_len="no" fi rm -f conftest* fi -echo "$ac_t""$ac_cv_c_sun_len" 1>&6 -if test "$ac_cv_c_sun_len" = "yes" +echo "$ac_t""$ac_cv_c_sockaddr_sun_len" 1>&6 +if test "$ac_cv_c_sockaddr_sun_len" = "yes" then cat >> confdefs.h <<\EOF #define HAVE_SOCKADDR_SUN_LEN 1 @@ -6878,12 +6915,12 @@ fi echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6 -echo "configure:6882: checking "whether we need to define __i386__"" >&5 +echo "configure:6919: checking "whether we need to define __i386__"" >&5 if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < +#include +], [static struct sockaddr addr; addr.sa_len = 1], + ac_cv_c_sockaddr_sa_len="yes", ac_cv_c_sockaddr_sa_len="no")) +if test "$ac_cv_c_sockaddr_sa_len" = "yes" +then + AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if struct sockaddr contains sa_len]) +fi + dnl *** Check for the sun_len member in struct sockaddr_un -AC_CACHE_CHECK("for sun_len in struct sockaddr_un", ac_cv_c_sun_len, +AC_CACHE_CHECK("for sun_len in struct sockaddr_un", ac_cv_c_sockaddr_sun_len, AC_TRY_COMPILE([#include #include #include ], [static struct sockaddr_un addr; addr.sun_len = 1], - ac_cv_c_sun_len="yes", ac_cv_c_sun_len="no")) -if test "$ac_cv_c_sun_len" = "yes" + ac_cv_c_sockaddr_sun_len="yes", ac_cv_c_sockaddr_sun_len="no")) +if test "$ac_cv_c_sockaddr_sun_len" = "yes" then AC_DEFINE(HAVE_SOCKADDR_SUN_LEN, 1, [Define if struct sockaddr_un contains sun_len]) fi diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c index 27b328bfaab..3b864fed0d5 100644 --- a/dlls/rpcrt4/rpcrt4_main.c +++ b/dlls/rpcrt4/rpcrt4_main.c @@ -105,7 +105,7 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid) * However, under earlier systems, sa_len isn't present, so * the size is just sizeof(struct ifreq) */ -#ifdef HAVE_SA_LEN +#ifdef HAVE_SOCKADDR_SA_LEN # ifndef max # define max(a,b) ((a) > (b) ? (a) : (b)) # endif @@ -113,8 +113,8 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid) sizeof((i).ifr_name)+(i).ifr_addr.sa_len) # else # define ifreq_size(i) sizeof(struct ifreq) -# endif /* HAVE_SA_LEN */ - +# endif /* defined(HAVE_SOCKADDR_SA_LEN) */ + sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); if (sd < 0) { /* if we can't open a socket, just use random numbers */ @@ -143,7 +143,7 @@ sizeof((i).ifr_name)+(i).ifr_addr.sa_len) } else { /* loop through the interfaces, looking for a valid one */ n = ifc.ifc_len; - for (i = 0; i < n; i+= ifreq_size(*ifr) ) { + for (i = 0; i < n; i+= ifreq_size(ifr) ) { ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i); strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ); /* try to get the address for this interface */ diff --git a/include/config.h.in b/include/config.h.in index 3e2bd4c740b..5829fd55770 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -520,6 +520,9 @@ /* Define if struct msghdr contains msg_accrights */ #undef HAVE_MSGHDR_ACCRIGHTS +/* Define if struct sockaddr contains sa_len */ +#undef HAVE_SOCKADDR_SA_LEN + /* Define if struct sockaddr_un contains sun_len */ #undef HAVE_SOCKADDR_SUN_LEN