From bf65cc041effe5e66f8561347c1448dea1cbd630 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 17 Nov 2013 14:16:13 -0700 Subject: [PATCH] Fixes for building under Tru64; from Daniel Richard G. Bug #624 --- common/event_poll.c | 2 +- compat/getaddrinfo.c | 2 +- config.h.in | 3 +++ configure | 13 +++++++++++++ configure.ac | 1 + m4/sudo.m4 | 12 ++++++++++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/common/event_poll.c b/common/event_poll.c index eeec9a3bb..5cf35cca7 100644 --- a/common/event_poll.c +++ b/common/event_poll.c @@ -79,8 +79,8 @@ sudo_ev_base_free_impl(struct sudo_event_base *base) int sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev) { - debug_decl(sudo_ev_add_impl, SUDO_DEBUG_EVENT) struct pollfd *pfd; + debug_decl(sudo_ev_add_impl, SUDO_DEBUG_EVENT) /* If out of space in pfds array, realloc. */ if (base->pfd_free == base->pfd_max) { diff --git a/compat/getaddrinfo.c b/compat/getaddrinfo.c index 6483670c6..f9d863022 100644 --- a/compat/getaddrinfo.c +++ b/compat/getaddrinfo.c @@ -140,7 +140,7 @@ static const char * const gai_errors[] = { }; /* Macro to set the len attribute of sockaddr_in. */ -#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN # define sin_set_length(s) ((s)->sin_len = sizeof(struct sockaddr_in)) #else # define sin_set_length(s) /* empty */ diff --git a/config.h.in b/config.h.in index 960c3f3a7..98c355cf9 100644 --- a/config.h.in +++ b/config.h.in @@ -602,6 +602,9 @@ /* Define to 1 if `pr_ttydev' is a member of `struct psinfo'. */ #undef HAVE_STRUCT_PSINFO_PR_TTYDEV +/* Define if your struct sockaddr_in has a sin_len field. */ +#undef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN + /* Define if your struct sockaddr has an sa_len field. */ #undef HAVE_STRUCT_SOCKADDR_SA_LEN diff --git a/configure b/configure index 78a004692..f979b74e8 100755 --- a/configure +++ b/configure @@ -16498,6 +16498,19 @@ $as_echo "#define HAVE_STRUCT_SOCKADDR_SA_LEN 1" >>confdefs.h fi + + ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" " +# include +# include + +" +if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = xyes; then : + +$as_echo "#define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1" >>confdefs.h + +fi + + _CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $OSDEFS" if test $ac_cv_header_utmpx_h = "yes"; then diff --git a/configure.ac b/configure.ac index f7e916195..06d65e64c 100644 --- a/configure.ac +++ b/configure.ac @@ -2205,6 +2205,7 @@ AC_CHECK_TYPE(rsize_t, size_t) AC_CHECK_TYPE(errno_t, int) SUDO_UID_T_LEN SUDO_SOCK_SA_LEN +SUDO_SOCK_SIN_LEN dnl dnl Check for utmp/utmpx struct members. dnl We need to include OSDEFS for glibc which only has __e_termination diff --git a/m4/sudo.m4 b/m4/sudo.m4 index 652fac640..234b4ec80 100644 --- a/m4/sudo.m4 +++ b/m4/sudo.m4 @@ -275,6 +275,18 @@ AC_DEFUN([SUDO_SOCK_SA_LEN], [ )] ) +dnl +dnl check for sin_len field in struct sockaddr_in +dnl +AC_DEFUN([SUDO_SOCK_SIN_LEN], [ + AC_CHECK_MEMBER([struct sockaddr_in.sin_len], + [AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN_SIN_LEN, 1, [Define if your struct sockaddr_in has a sin_len field.])], + [], [ +# include +# include ] + )] +) + dnl dnl check for max length of uid_t in string representation. dnl we can't really trust UID_MAX or MAXUID since they may exist -- 2.40.0