[openssh-commits] [openssh] 01/01: Use LONG_LONG_MAX and friends if available.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri May 1 18:41:56 AEST 2020

This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit e9dc9863723e111ae05e353d69df857f0169544a
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Fri May 1 18:32:25 2020 +1000

    Use LONG_LONG_MAX and friends if available.
    If we don't have LLONG_{MIN,MAX} but do have LONG_LONG_{MIN,MAX}
    then use those instead.  We do calculate these values in configure,
    but it turns out that at least one compiler (old HP ANSI C) can't
    parse "-9223372036854775808LL" without mangling it. (It can parse
    "-9223372036854775807LL" which is presumably why its limits.h defines
    LONG_LONG_MIN as the latter minus 1.)
    Fixes rekey test when compiled with the aforementioned compiler.
 configure.ac | 3 ++-
 defines.h    | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index e696ac75..e89d4f17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,7 @@ AC_SUBST([LD])
 AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
+AC_CHECK_DECL([LONG_LONG_MAX], [have_long_long_max=1], , [#include <limits.h>])
 AC_CHECK_DECL([SYSTR_POLICY_KILL], [have_systr_policy_kill=1], , [
 	#include <sys/types.h>
 	#include <sys/param.h>
@@ -3611,7 +3612,7 @@ if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
 # compute LLONG_MIN and LLONG_MAX if we don't know them.
-if test -z "$have_llong_max"; then
+if test -z "$have_llong_max" && test -z "$have_long_long_max"; then
 	AC_MSG_CHECKING([for max value of long long])
diff --git a/defines.h b/defines.h
index a347a44f..b8ea88b2 100644
--- a/defines.h
+++ b/defines.h
@@ -254,6 +254,13 @@ typedef unsigned int u_int32_t;
 #define __BIT_TYPES_DEFINED__
+#if !defined(LLONG_MIN) && defined(LONG_LONG_MIN)
+#if !defined(LLONG_MAX) && defined(LONG_LONG_MAX)
 #ifndef UINT32_MAX
 # if defined(HAVE_DECL_UINT32_MAX) && (HAVE_DECL_UINT32_MAX == 0)
 #  if (SIZEOF_INT == 4)

To stop receiving notification emails like this one, please contact
djm at mindrot.org.

More information about the openssh-commits mailing list