diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-03-22 17:41:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-03-22 17:41:47 +0000 |
commit | b32cac8055118d264b27b1073d3d43e9a127130e (patch) | |
tree | 1d9f228f94653c7cf7d1485163428bef1ba52390 /src/backend/utils/misc/guc.c | |
parent | 339cd6b9b00451f1f7046d6b52500e2d2992a385 (diff) |
Fix Joubert's complaint that int8-sized numeric literals are mishandled
on Alpha (because parser mistakenly assumes that a nonoverflow result
from strtol means the value will fit into int4). A scan for other uses
of strtol and strtoul found a couple other places with the same mistake;
fix them too. The changes are all conditional on HAVE_LONG_INT_64 to
avoid complaints from compilers that think x != x is a silly test
(cf. pg_atoi).
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index feceb5d9500..1d779979a19 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -4,7 +4,7 @@ * Support for grand unified configuration scheme, including SET * command, configuration file, and command line options. * - * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.34 2001/03/22 04:00:06 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.35 2001/03/22 17:41:47 tgl Exp $ * * Copyright 2000 by PostgreSQL Global Development Group * Written by Peter Eisentraut <peter_e@gmx.net>. @@ -520,7 +520,12 @@ parse_int(const char *value, int *result) errno = 0; val = strtol(value, &endptr, 0); - if (endptr == value || *endptr != '\0' || errno == ERANGE) + if (endptr == value || *endptr != '\0' || errno == ERANGE +#ifdef HAVE_LONG_INT_64 + /* if long > 32 bits, check for overflow of int4 */ + || val != (long) ((int32) val) +#endif + ) return false; if (result) *result = (int) val; |