Here is the patch, to the patches list.
---------------------------------------------------------------------------
Kurt Roeckx wrote:
> On Tue, Jun 17, 2003 at 11:01:27PM -0500, Bruno Wolff III wrote:
> >
> > My system does have its own sockaddr_storage definition. I think
> > it uses __ss_ as the prefix. Also, after looking at the fallback
> > definition in pqcomm.h, I don't see where that defines ss_family
> > and hence don't see how that could work.
> > I am going to see if adding __ works as suggested by someone else
> > who replied.
>
> See if this patch helps.
>
> Don't forget to run autoconf after applying the patch.
>
>
>
> Kurt
>
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.275
diff -c -c -r1.275 configure
*** configure 18 Jun 2003 16:04:15 -0000 1.275
--- configure 23 Jun 2003 23:37:54 -0000
***************
*** 9871,9876 ****
--- 9871,9997 ----
fi
+ echo "$as_me:$LINENO: checking for struct sockaddr_storage.ss_family" >&5
+ echo $ECHO_N "checking for struct sockaddr_storage.ss_family... $ECHO_C" >&6
+ if test "${ac_cv_member_struct_sockaddr_storage_ss_family+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+
+
+ #ifdef F77_DUMMY_MAIN
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+ int F77_DUMMY_MAIN() { return 1; }
+ #endif
+ int
+ main ()
+ {
+ static struct sockaddr_storage ac_aggr;
+ if (ac_aggr.ss_family)
+ return 0;
+ ;
+ return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_struct_sockaddr_storage_ss_family=yes
+ else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_member_struct_sockaddr_storage_ss_family=no
+ fi
+ rm -f conftest.$ac_objext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_storage_ss_family" >&5
+ echo "${ECHO_T}$ac_cv_member_struct_sockaddr_storage_ss_family" >&6
+ if test $ac_cv_member_struct_sockaddr_storage_ss_family = yes; then
+
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
+ _ACEOF
+
+
+ fi
+ echo "$as_me:$LINENO: checking for struct sockaddr_storage.__ss_family" >&5
+ echo $ECHO_N "checking for struct sockaddr_storage.__ss_family... $ECHO_C" >&6
+ if test "${ac_cv_member_struct_sockaddr_storage___ss_family+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+ cat >conftest.$ac_ext <<_ACEOF
+ #line $LINENO "configure"
+ #include "confdefs.h"
+ #include <sys/types.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+
+
+ #ifdef F77_DUMMY_MAIN
+ # ifdef __cplusplus
+ extern "C"
+ # endif
+ int F77_DUMMY_MAIN() { return 1; }
+ #endif
+ int
+ main ()
+ {
+ static struct sockaddr_storage ac_aggr;
+ if (ac_aggr.__ss_family)
+ return 0;
+ ;
+ return 0;
+ }
+ _ACEOF
+ rm -f conftest.$ac_objext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_member_struct_sockaddr_storage___ss_family=yes
+ else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_member_struct_sockaddr_storage___ss_family=no
+ fi
+ rm -f conftest.$ac_objext conftest.$ac_ext
+ fi
+ echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_storage___ss_family" >&5
+ echo "${ECHO_T}$ac_cv_member_struct_sockaddr_storage___ss_family" >&6
+ if test $ac_cv_member_struct_sockaddr_storage___ss_family = yes; then
+
+ cat >>confdefs.h <<_ACEOF
+ #define HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY 1
+ _ACEOF
+
+
+ fi
+
echo "$as_me:$LINENO: checking for struct addrinfo" >&5
echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6
if test "${ac_cv_type_struct_addrinfo+set}" = set; then
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.266
diff -c -c -r1.266 configure.in
*** configure.in 18 Jun 2003 16:04:15 -0000 1.266
--- configure.in 23 Jun 2003 23:37:55 -0000
***************
*** 778,783 ****
--- 778,784 ----
PGAC_UNION_SEMUN
PGAC_STRUCT_SOCKADDR_UN
PGAC_STRUCT_SOCKADDR_STORAGE
+ PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
PGAC_STRUCT_ADDRINFO
AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
Index: config/c-library.m4
===================================================================
RCS file: /cvsroot/pgsql-server/config/c-library.m4,v
retrieving revision 1.21
diff -c -c -r1.21 c-library.m4
*** config/c-library.m4 12 Jun 2003 16:05:10 -0000 1.21
--- config/c-library.m4 23 Jun 2003 23:37:55 -0000
***************
*** 110,115 ****
--- 110,128 ----
#endif
])])# PGAC_STRUCT_SOCKADDR_STORAGE
+ # PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
+ # --------------------------------------
+ # This checks if the struct sockaddr has a proper ss_family and not an
+ # __ss_family as rfc2553 defined.
+ AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY],
+ [AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family,
+ struct sockaddr_storage.__ss_family], [], [],
+ [#include <sys/types.h>
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+ ])])# PGAC_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
+
# PGAC_STRUCT_ADDRINFO
# -----------------------
Index: src/include/pg_config.h.in
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/pg_config.h.in,v
retrieving revision 1.53
diff -c -c -r1.53 pg_config.h.in
*** src/include/pg_config.h.in 15 Jun 2003 04:09:18 -0000 1.53
--- src/include/pg_config.h.in 23 Jun 2003 23:38:02 -0000
***************
*** 423,428 ****
--- 423,434 ----
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#undef HAVE_STRUCT_SOCKADDR_STORAGE
+ /* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
+ #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
+
+ /* Define to 1 if `__ss_family' is member of `struct sockaddr_storage'. */
+ #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
+
/* Define to 1 if the system has the type `struct sockaddr_un'. */
#undef HAVE_STRUCT_SOCKADDR_UN
Index: src/include/libpq/pqcomm.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/libpq/pqcomm.h,v
retrieving revision 1.86
diff -c -c -r1.86 pqcomm.h
*** src/include/libpq/pqcomm.h 12 Jun 2003 07:36:51 -0000 1.86
--- src/include/libpq/pqcomm.h 23 Jun 2003 23:38:02 -0000
***************
*** 65,70 ****
--- 65,76 ----
* _SS_MAXSIZE value minus size of ss_family
* __ss_pad1, __ss_align fields is 112 */
};
+ #elif !defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
+ # ifdef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
+ # define ss_family __ss_family
+ # else
+ # error struct sockaddr_storage does not provide an ss_family member
+ # endif
#endif
typedef struct {
Index: src/port/getaddrinfo.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/getaddrinfo.c,v
retrieving revision 1.8
diff -c -c -r1.8 getaddrinfo.c
*** src/port/getaddrinfo.c 14 Jun 2003 18:20:33 -0000 1.8
--- src/port/getaddrinfo.c 23 Jun 2003 23:38:03 -0000
***************
*** 220,226 ****
char *node, int nodelen,
char *service, int servicelen, int flags)
{
- sa_family_t family;
int ret = -1;
/* Invalid arguments. */
--- 220,225 ----
***************
*** 236,244 ****
return EAI_FAIL;
}
- family = sa->sa_family;
#ifdef HAVE_IPV6
! if (family == AF_INET6)
{
return EAI_FAMILY;
}
--- 235,242 ----
return EAI_FAIL;
}
#ifdef HAVE_IPV6
! if (sa->sa_family == AF_INET6)
{
return EAI_FAMILY;
}
***************
*** 246,258 ****
if (service)
{
! if (family == AF_INET)
{
ret = snprintf(service, servicelen, "%d",
ntohs(((struct sockaddr_in *)sa)->sin_port));
}
#ifdef HAVE_UNIX_SOCKETS
! else if (family == AF_UNIX)
{
ret = snprintf(service, servicelen, "%s",
((struct sockaddr_un *)sa)->sun_path);
--- 244,256 ----
if (service)
{
! if (sa->sa_family == AF_INET)
{
ret = snprintf(service, servicelen, "%d",
ntohs(((struct sockaddr_in *)sa)->sin_port));
}
#ifdef HAVE_UNIX_SOCKETS
! else if (sa->sa_family == AF_UNIX)
{
ret = snprintf(service, servicelen, "%s",
((struct sockaddr_un *)sa)->sun_path);
***************
*** 266,279 ****
if (node)
{
! if (family == AF_INET)
{
char *p;
p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
ret = snprintf(node, nodelen, "%s", p);
}
#ifdef HAVE_UNIX_SOCKETS
! else if (family == AF_UNIX)
{
ret = snprintf(node, nodelen, "%s", "localhost");
}
--- 264,277 ----
if (node)
{
! if (sa->sa_family == AF_INET)
{
char *p;
p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
ret = snprintf(node, nodelen, "%s", p);
}
#ifdef HAVE_UNIX_SOCKETS
! else if (sa->sa_family == AF_UNIX)
{
ret = snprintf(node, nodelen, "%s", "localhost");
}