diff --git a/config.h.in b/config.h.in index 0b0234a1b..50280146d 100644 --- a/config.h.in +++ b/config.h.in @@ -89,10 +89,46 @@ */ #undef HAVE_DECL_ERRNO +/* Define to 1 if you have the declaration of `HOST_NAME_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_HOST_NAME_MAX + /* Define to 1 if you have the declaration of `h_errno', and to 0 if you don't. */ #undef HAVE_DECL_H_ERRNO +/* Define to 1 if you have the declaration of `LLONG_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_LLONG_MAX + +/* Define to 1 if you have the declaration of `LLONG_MIN', and to 0 if you + don't. */ +#undef HAVE_DECL_LLONG_MIN + +/* Define to 1 if you have the declaration of `OPEN_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_OPEN_MAX + +/* Define to 1 if you have the declaration of `PATH_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_PATH_MAX + +/* Define to 1 if you have the declaration of `QUAD_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_QUAD_MAX + +/* Define to 1 if you have the declaration of `QUAD_MIN', and to 0 if you + don't. */ +#undef HAVE_DECL_QUAD_MIN + +/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_SIZE_MAX + +/* Define to 1 if you have the declaration of `SIZE_T_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_SIZE_T_MAX + /* Define to 1 if you have the declaration of `sys_sigabbrev', and to 0 if you don't. */ #undef HAVE_DECL_SYS_SIGABBREV @@ -105,6 +141,22 @@ don't. */ #undef HAVE_DECL_SYS_SIGNAME +/* Define to 1 if you have the declaration of `ULLONG_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_ULLONG_MAX + +/* Define to 1 if you have the declaration of `UQUAD_MAX', and to 0 if you + don't. */ +#undef HAVE_DECL_UQUAD_MAX + +/* Define to 1 if you have the declaration of `_POSIX_HOST_NAME_MAX', and to 0 + if you don't. */ +#undef HAVE_DECL__POSIX_HOST_NAME_MAX + +/* Define to 1 if you have the declaration of `_POSIX_PATH_MAX', and to 0 if + you don't. */ +#undef HAVE_DECL__POSIX_PATH_MAX + /* Define to 1 if you have the declaration of `_sys_siglist', and to 0 if you don't. */ #undef HAVE_DECL__SYS_SIGLIST diff --git a/configure b/configure index 1d056f555..c12bddc0f 100755 --- a/configure +++ b/configure @@ -20360,6 +20360,208 @@ cat >>confdefs.h <<_ACEOF _ACEOF +ac_fn_c_check_decl "$LINENO" "OPEN_MAX" "ac_cv_have_decl_OPEN_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_OPEN_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_OPEN_MAX $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "LLONG_MAX" "ac_cv_have_decl_LLONG_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_LLONG_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LLONG_MAX $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "LLONG_MIN" "ac_cv_have_decl_LLONG_MIN" " +#include +#include + +" +if test "x$ac_cv_have_decl_LLONG_MIN" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LLONG_MIN $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "ULLONG_MAX" "ac_cv_have_decl_ULLONG_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_ULLONG_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ULLONG_MAX $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "SIZE_MAX" "ac_cv_have_decl_SIZE_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_SIZE_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SIZE_MAX $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "PATH_MAX" "ac_cv_have_decl_PATH_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_PATH_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PATH_MAX $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "HOST_NAME_MAX" "ac_cv_have_decl_HOST_NAME_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_HOST_NAME_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_HOST_NAME_MAX $ac_have_decl +_ACEOF + +if test "$ac_cv_have_decl_LLONG_MAX" != "yes"; then + ac_fn_c_check_decl "$LINENO" "QUAD_MAX" "ac_cv_have_decl_QUAD_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_QUAD_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_QUAD_MAX $ac_have_decl +_ACEOF + +fi +if test "$ac_cv_have_decl_LLONG_MIN" != "yes"; then + ac_fn_c_check_decl "$LINENO" "QUAD_MIN" "ac_cv_have_decl_QUAD_MIN" " +#include +#include + +" +if test "x$ac_cv_have_decl_QUAD_MIN" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_QUAD_MIN $ac_have_decl +_ACEOF + +fi +if test "$ac_cv_have_decl_ULLONG_MAX" != "yes"; then + ac_fn_c_check_decl "$LINENO" "UQUAD_MAX" "ac_cv_have_decl_UQUAD_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_UQUAD_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UQUAD_MAX $ac_have_decl +_ACEOF + +fi +if test "$ac_cv_have_decl_SIZE_MAX" != "yes"; then + ac_fn_c_check_decl "$LINENO" "SIZE_T_MAX" "ac_cv_have_decl_SIZE_T_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl_SIZE_T_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SIZE_T_MAX $ac_have_decl +_ACEOF + +fi +if test "$ac_cv_have_decl_PATH_MAX" != "yes"; then + ac_fn_c_check_decl "$LINENO" "_POSIX_PATH_MAX" "ac_cv_have_decl__POSIX_PATH_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl__POSIX_PATH_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__POSIX_PATH_MAX $ac_have_decl +_ACEOF + +fi +if test "$ac_cv_have_decl_HOST_NAME_MAX" != "yes"; then + ac_fn_c_check_decl "$LINENO" "_POSIX_HOST_NAME_MAX" "ac_cv_have_decl__POSIX_HOST_NAME_MAX" " +#include +#include + +" +if test "x$ac_cv_have_decl__POSIX_HOST_NAME_MAX" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__POSIX_HOST_NAME_MAX $ac_have_decl +_ACEOF + +fi + for ac_func in strsignal do : ac_fn_c_check_func "$LINENO" "strsignal" "ac_cv_func_strsignal" diff --git a/configure.ac b/configure.ac index f4fa0c775..1d27a5c52 100644 --- a/configure.ac +++ b/configure.ac @@ -2945,6 +2945,53 @@ AC_INCLUDES_DEFAULT #include ]) +dnl +dnl Check for incomplete limits.h +dnl +AC_CHECK_DECLS([OPEN_MAX, LLONG_MAX, LLONG_MIN, ULLONG_MAX, SIZE_MAX, PATH_MAX, HOST_NAME_MAX], [], [], [ +#include +#include +]) +dnl +dnl Try to find equivalents for missing types +dnl +if test "$ac_cv_have_decl_LLONG_MAX" != "yes"; then + AC_CHECK_DECLS([QUAD_MAX], [], [], [[ +#include +#include + ]]) +fi +if test "$ac_cv_have_decl_LLONG_MIN" != "yes"; then + AC_CHECK_DECLS([QUAD_MIN], [], [], [[ +#include +#include + ]]) +fi +if test "$ac_cv_have_decl_ULLONG_MAX" != "yes"; then + AC_CHECK_DECLS([UQUAD_MAX], [], [], [[ +#include +#include + ]]) +fi +if test "$ac_cv_have_decl_SIZE_MAX" != "yes"; then + AC_CHECK_DECLS([SIZE_T_MAX], [], [], [[ +#include +#include + ]]) +fi +if test "$ac_cv_have_decl_PATH_MAX" != "yes"; then + AC_CHECK_DECLS([_POSIX_PATH_MAX], [], [], [[ +#include +#include + ]]) +fi +if test "$ac_cv_have_decl_HOST_NAME_MAX" != "yes"; then + AC_CHECK_DECLS([_POSIX_HOST_NAME_MAX], [], [], [[ +#include +#include + ]]) +fi + dnl dnl Check for strsignal() or sys_siglist dnl diff --git a/include/sudo_compat.h b/include/sudo_compat.h index 09e60becf..2af220ad9 100644 --- a/include/sudo_compat.h +++ b/include/sudo_compat.h @@ -120,52 +120,52 @@ /* * Some systems lack full limit definitions. */ -#ifndef OPEN_MAX +#if defined(HAVE_DECL_OPEN_MAX) && !HAVE_DECL_OPEN_MAX # define OPEN_MAX 256 #endif -#ifndef LLONG_MAX -# if defined(QUAD_MAX) +#if defined(HAVE_DECL_LLONG_MAX) && !HAVE_DECL_LLONG_MAX +# if defined(HAVE_DECL_QUAD_MAX) && HAVE_DECL_QUAD_MAX # define LLONG_MAX QUAD_MAX # else # define LLONG_MAX 0x7fffffffffffffffLL # endif #endif -#ifndef LLONG_MIN -# if defined(QUAD_MIN) +#if defined(HAVE_DECL_LLONG_MIN) && !HAVE_DECL_LLONG_MIN +# if defined(HAVE_DECL_QUAD_MIN) && HAVE_DECL_QUAD_MIN # define LLONG_MIN QUAD_MIN # else # define LLONG_MIN (-0x7fffffffffffffffLL-1) # endif #endif -#ifndef ULLONG_MAX -# if defined(UQUAD_MAX) +#if defined(HAVE_DECL_ULLONG_MAX) && !HAVE_DECL_ULLONG_MAX +# if defined(HAVE_DECL_UQUAD_MAX) && HAVE_DECL_UQUAD_MAX # define ULLONG_MAX UQUAD_MAX # else # define ULLONG_MAX 0xffffffffffffffffULL # endif #endif -#ifndef SIZE_MAX -# ifdef SIZE_T_MAX +#if defined(HAVE_DECL_SIZE_MAX) && !HAVE_DECL_SIZE_MAX +# if defined(HAVE_DECL_SIZE_T_MAX) && HAVE_DECL_SIZE_T_MAX # define SIZE_MAX SIZE_T_MAX # else # define SIZE_MAX ULONG_MAX -# endif /* SIZE_T_MAX */ -#endif /* SIZE_MAX */ +# endif +#endif -#ifndef PATH_MAX -# ifdef _POSIX_PATH_MAX +#if defined(HAVE_DECL_PATH_MAX) && !HAVE_DECL_PATH_MAX +# if defined(HAVE_DECL__POSIX_PATH_MAX) && HAVE_DECL__POSIX_PATH_MAX # define PATH_MAX _POSIX_PATH_MAX # else # define PATH_MAX 256 # endif #endif -#ifndef HOST_NAME_MAX -# ifdef _POSIX_HOST_NAME_MAX +#if defined(HAVE_DECL_HOST_NAME_MAX) && !HAVE_DECL_HOST_NAME_MAX +# if defined(HAVE_DECL__POSIX_HOST_NAME_MAX) && HAVE_DECL__POSIX_HOST_NAME_MAX # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX # else # define HOST_NAME_MAX 255 @@ -319,7 +319,7 @@ extern int errno; #endif /* For sig2str() */ -#ifndef SIG2STR_MAX +#ifndef HAVE_SIG2STR # define SIG2STR_MAX 32 #endif