From ae0982d306693fceaa3bb53baf89eed74beb3918 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 30 Oct 2009 17:47:35 +0000 Subject: [PATCH] add configure test for sockaddr_in.sin_len member git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@237 e5f2f494-b856-4b98-b285-d166d9295462 --- configure.ac | 9 +++++++++ src/bin/parkinglot/Makefile.am | 2 +- src/lib/cc/cpp/session.cc | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 235b6d79d7..da8867d7d6 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,15 @@ AC_PROG_RANLIB AC_HEADER_STDBOOL AC_TYPE_SIZE_T +AC_MSG_CHECKING(for sa_len in struct sockaddr) +AC_TRY_COMPILE([ +#include +#include ], +[struct sockaddr sa; sa.sa_len = 0; return (0);], + [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SIN_LEN, 1, Define to 1 if sockaddr_in has a sin_len member)], + AC_MSG_RESULT(no)) + # # Check availablity of gtest, which might be used for unit tests. # diff --git a/src/bin/parkinglot/Makefile.am b/src/bin/parkinglot/Makefile.am index 74281f657a..dc228681fe 100644 --- a/src/bin/parkinglot/Makefile.am +++ b/src/bin/parkinglot/Makefile.am @@ -2,4 +2,4 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_srcdir)/ext bin_PROGRAMS = parkinglot parkinglot_SOURCES = common.cc main.cc -parkinglot_LDADD = $(top_srcdir)/src/lib/dns/libdns.a +parkinglot_LDADD = $(top_srcdir)/src/lib/dns/libdns.a $(top_srcdir)/src/lib/cc/cpp/libcc.a diff --git a/src/lib/cc/cpp/session.cc b/src/lib/cc/cpp/session.cc index 11b89c6377..8a2800a8c6 100644 --- a/src/lib/cc/cpp/session.cc +++ b/src/lib/cc/cpp/session.cc @@ -36,10 +36,14 @@ Session::establish() if (sock < -1) throw SessionError("socket() failed"); - sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; sin.sin_port = htons(9912); sin.sin_addr.s_addr = INADDR_ANY; + +#ifdef HAVE_SIN_LEN + sin.sin_len = sizeof(struct sockaddr_in); +#endif + ret = connect(sock, (struct sockaddr *)&sin, sizeof(sin)); if (ret < 0) throw SessionError("connect() failed");