From: Jeremy Harris Date: Sat, 17 Nov 2012 21:47:26 +0000 (+0000) Subject: Fix 64b build. X-Git-Tag: exim-4_81_RC1~3^2~38 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/4328fd3cb019281becab844b6bf560632b1d34b1 Fix 64b build. --- diff --git a/src/src/config.h.defaults b/src/src/config.h.defaults index ef83621b3..361051858 100644 --- a/src/src/config.h.defaults +++ b/src/src/config.h.defaults @@ -180,7 +180,10 @@ just in case. */ #define ROOT_UID 0 #define ROOT_GID 0 -/* Sizes for integer arithmetic. Go for 64bit; can be overridden in OS/Makefile-FOO */ +/* Sizes for integer arithmetic. +Go for 64bit; can be overridden in OS/Makefile-FOO +If you make it a different number of bits, provide a definition +for EXIM_64B_MAX and _MIN in OS/oh.h-FOO */ #define int_eximarith_t int64_t #define PR_EXIM_ARITH "%" PRId64 /* C99 standard, printf %lld */ #define SC_EXIM_ARITH "%" SCNi64 /* scanf incl. 0x prefix */ diff --git a/src/src/exim.h b/src/src/exim.h index 2816fc98a..066e99d21 100644 --- a/src/src/exim.h +++ b/src/src/exim.h @@ -106,6 +106,15 @@ making unique names. */ #define UCHAR_MAX 255 #endif + +/* To match int_eximarith_t. Define in OS/os.h- to override. */ +#ifndef EXIM_ARITH_MAX +# define EXIM_ARITH_MAX ((int_eximarith_t)9223372036854775807LL) +#endif +#ifndef EXIM_ARITH_MIN +# define EXIM_ARITH_MIN (-EXIM_ARITH_MAX - 1) +#endif + /* Some systems have PATH_MAX and some have MAX_PATH_LEN. */ #ifndef PATH_MAX diff --git a/src/src/expand.c b/src/src/expand.c index 9fc00cf41..c7dc2742c 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -3389,12 +3389,12 @@ if (*error == NULL) * can just let the other invalid results occur otherwise, as they have * until now. For this one case, we can coerce. */ - if (y == -1 && x == LLONG_MIN && op != '*') + if (y == -1 && x == EXIM_ARITH_MIN && op != '*') { DEBUG(D_expand) debug_printf("Integer exception dodging: " PR_EXIM_ARITH "%c-1 coerced to " PR_EXIM_ARITH "\n", - LLONG_MIN, op, LLONG_MAX); - x = LLONG_MAX; + EXIM_ARITH_MIN, op, EXIM_ARITH_MAX); + x = EXIM_ARITH_MAX; continue; } if (op == '*') @@ -6514,17 +6514,17 @@ else default: break; case 'k': - if (value > LLONG_MAX/1024 || value < LLONG_MIN/1024) errno = ERANGE; + if (value > EXIM_ARITH_MAX/1024 || value < EXIM_ARITH_MIN/1024) errno = ERANGE; else value *= 1024; endptr++; break; case 'm': - if (value > LLONG_MAX/(1024*1024) || value < LLONG_MIN/(1024*1024)) errno = ERANGE; + if (value > EXIM_ARITH_MAX/(1024*1024) || value < EXIM_ARITH_MIN/(1024*1024)) errno = ERANGE; else value *= 1024*1024; endptr++; break; case 'g': - if (value > LLONG_MAX/(1024*1024*1024) || value < LLONG_MIN/(1024*1024*1024)) errno = ERANGE; + if (value > EXIM_ARITH_MAX/(1024*1024*1024) || value < EXIM_ARITH_MIN/(1024*1024*1024)) errno = ERANGE; else value *= 1024*1024*1024; endptr++; break;