]> granicus.if.org Git - sudo/commitdiff
Avoid inadvertantly defining things like PATH_MAX simply because
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jan 2015 00:01:30 +0000 (17:01 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jan 2015 00:01:30 +0000 (17:01 -0700)
the source file doesn't include limits.h.

config.h.in
configure
configure.ac
include/sudo_compat.h

index 0b0234a1be757c850ca9f59f65cd9d943e166081..50280146d1bdb0bc6c97623ef18aa5a4e3b95ed6 100644 (file)
    */
 #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
    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
index 1d056f555c88f9b03d9c044a625aa59c304de068..c12bddc0f1e69093dd4369953022fc3bad318898 100755 (executable)
--- 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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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 <sys/types.h>
+#include <limits.h>
+
+"
+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"
index f4fa0c7755c9fcd662cf381f9eb8e66f8ede15e5..1d27a5c527929a280ca4dfc41e2a909c6fd7a4b9 100644 (file)
@@ -2945,6 +2945,53 @@ AC_INCLUDES_DEFAULT
 #include <netdb.h>
 ])
 
+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 <sys/types.h>
+#include <limits.h>
+])
+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 <sys/types.h>
+#include <limits.h>
+    ]])
+fi
+if test "$ac_cv_have_decl_LLONG_MIN" != "yes"; then
+    AC_CHECK_DECLS([QUAD_MIN], [], [], [[
+#include <sys/types.h>
+#include <limits.h>
+    ]])
+fi
+if test "$ac_cv_have_decl_ULLONG_MAX" != "yes"; then
+    AC_CHECK_DECLS([UQUAD_MAX], [], [], [[
+#include <sys/types.h>
+#include <limits.h>
+    ]])
+fi
+if test "$ac_cv_have_decl_SIZE_MAX" != "yes"; then
+    AC_CHECK_DECLS([SIZE_T_MAX], [], [], [[
+#include <sys/types.h>
+#include <limits.h>
+    ]])
+fi
+if test "$ac_cv_have_decl_PATH_MAX" != "yes"; then
+    AC_CHECK_DECLS([_POSIX_PATH_MAX], [], [], [[
+#include <sys/types.h>
+#include <limits.h>
+    ]])
+fi
+if test "$ac_cv_have_decl_HOST_NAME_MAX" != "yes"; then
+    AC_CHECK_DECLS([_POSIX_HOST_NAME_MAX], [], [], [[
+#include <sys/types.h>
+#include <limits.h>
+    ]])
+fi
+
 dnl
 dnl Check for strsignal() or sys_siglist
 dnl
index 09e60becf105cbaaec8492ac3192c061a405cf19..2af220ad95f78291caccae6650c0b624a9db6790 100644 (file)
 /*
  * 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