--=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Erik Inge Bolsø <[email protected]> wrote: > ... anyone feel like adding a configure check and a patch for this? > Probably a certain libc or a certain distro has this problem. Patch attached. Apply, run aclocal, autoconf, autoheader. Maybe I should ask for cvs write access, someday :) JB. -- Julien BLACHE <http://www.jblache.org> <[email protected]> --=-=-= Content-Disposition: attachment; filename=ss_family-check.diff Content-Description: Check for ss_family or __ss_family --- sane-backends-1.0.12.orig/acinclude.m4 2003-05-15 12:51:16.000000000 +0200 +++ sane-backends-1.0.12/acinclude.m4 2003-06-03 18:34:09.000000000 +0200 @@ -353,6 +353,7 @@ # # Check for AF_INET6, determines whether or not to enable IPv6 support +# Check for ss_family member in struct sockaddr_storage AC_DEFUN([SANE_CHECK_IPV6], [ AC_MSG_CHECKING([whether to enable IPv6]) @@ -383,6 +384,38 @@ ipv6=no ]) fi + + if test "$ipv6" != "no" ; then + AC_MSG_CHECKING([whether struct sockaddr_storage has an ss_family member]) + AC_TRY_COMPILE([ + #define INET6 + #include <sys/types.h> + #include <sys/socket.h> ], [ + /* test if the ss_family member exists in struct sockaddr_storage */ + struct sockaddr_storage ss; + ss.ss_family = AF_INET; + exit (0); + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAS_SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has an ss_family member]) + ], [ + AC_TRY_COMPILE([ + #define INET6 + #include <sys/types.h> + #include <sys/socket.h> ], [ + /* test if the __ss_family member exists in struct sockaddr_storage */ + struct sockaddr_storage ss; + ss.__ss_family = AF_INET; + exit (0); + ], [ + AC_MSG_RESULT([no, but __ss_family exists]) + AC_DEFINE([HAS___SS_FAMILY], 1, [Define to 1 if struct sockaddr_storage has __ss_family instead of ss_family]) + ], [ + AC_MSG_RESULT([no]) + ipv6=no + ]) + ]) + fi ]) # --- sane-backends-1.0.12.orig/frontend/saned.c 2003-05-12 18:34:03.000000000 +0200 +++ sane-backends-1.0.12/frontend/saned.c 2003-06-03 18:39:11.000000000 +0200 @@ -34,6 +34,14 @@ #if defined(HAVE_GETADDRINFO) && defined (HAVE_GETNAMEINFO) # define SANED_USES_AF_INDEP +# ifdef HAS_SS_FAMILY +# define SS_FAMILY(ss) ss.ss_family +# elif defined(HAS___SS_FAMILY) +# define SS_FAMILY(ss) ss.__ss_family +# else /* fallback to the old, IPv4-only code */ +# undef SANED_USES_AF_INDEP +# undef ENABLE_IPV6 +# endif #else # undef ENABLE_IPV6 #endif /* HAVE_GETADDRINFO && HAVE_GETNAMEINFO && HAVE_POLL */ @@ -556,7 +564,7 @@ sin = (struct sockaddr_in *) &remote_address; - switch (remote_address.ss_family) + switch (SS_FAMILY(remote_address)) { case AF_INET: if (IN_LOOPBACK (ntohl (sin->sin_addr.s_addr))) @@ -1022,7 +1030,7 @@ return -1; } - fd = socket (ss.ss_family, SOCK_STREAM, 0); + fd = socket (SS_FAMILY(ss), SOCK_STREAM, 0); if (fd < 0) { DBG (DBG_ERR, "start_scan: failed to obtain data socket (%s)\n", @@ -1031,7 +1039,7 @@ return -1; } - switch (ss.ss_family) + switch (SS_FAMILY(ss)) { case AF_INET: sin = (struct sockaddr_in *) &ss; @@ -1071,7 +1079,7 @@ return -1; } - switch (ss.ss_family) + switch (SS_FAMILY(ss)) { case AF_INET: sin = (struct sockaddr_in *) &ss; --=-=-=--
