Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f810cfb

Browse files
committed
Disable strtoul() ERANGE check on Win32, because it isn't thread safe,
and it isn't really required.
1 parent 2763980 commit f810cfb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/interfaces/libpq/fe-exec.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.170 2005/07/02 17:01:54 momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.171 2005/08/13 01:34:30 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2166,7 +2166,15 @@ PQoidValue(const PGresult *res)
21662166
#endif
21672167
result = strtoul(res->cmdStatus + 7, &endptr, 10);
21682168

2169-
if (!endptr || (*endptr != ' ' && *endptr != '\0') || errno == ERANGE)
2169+
if (!endptr || (*endptr != ' ' && *endptr != '\0')
2170+
#ifndef WIN32
2171+
/*
2172+
* On WIN32, errno is not thread-safe and GetLastError() isn't set by
2173+
* strtoul(), so we can't check on this platform.
2174+
*/
2175+
|| errno == ERANGE
2176+
#endif
2177+
)
21702178
return InvalidOid;
21712179
else
21722180
return (Oid) result;

0 commit comments

Comments
 (0)