mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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).
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user