diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2012-11-17 21:47:26 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2012-11-22 20:59:54 +0000 |
commit | 4328fd3cb019281becab844b6bf560632b1d34b1 (patch) | |
tree | f8498941bdbac2c166ba7420edb1f2040d5c7ce5 | |
parent | 3f1df0e341c4ddc4add38fa97d9d34972655a6c7 (diff) |
Fix 64b build.
-rw-r--r-- | src/src/config.h.defaults | 5 | ||||
-rw-r--r-- | src/src/exim.h | 9 | ||||
-rw-r--r-- | src/src/expand.c | 12 |
3 files changed, 19 insertions, 7 deletions
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-<your-system> 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; |