aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r--src/interfaces/libpq/fe-exec.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 2f3bd87317d..e5a1e737c36 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.171 2005/08/13 01:34:30 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.172 2005/08/23 20:45:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2156,25 +2156,16 @@ PQoidValue(const PGresult *res)
char *endptr = NULL;
unsigned long result;
- if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
+ if (!res ||
+ !res->cmdStatus ||
+ strncmp(res->cmdStatus, "INSERT ", 7) != 0 ||
+ res->cmdStatus[7] < '0' ||
+ res->cmdStatus[7] > '9')
return InvalidOid;
-#ifdef WIN32
- SetLastError(0);
-#else
- errno = 0;
-#endif
result = strtoul(res->cmdStatus + 7, &endptr, 10);
- if (!endptr || (*endptr != ' ' && *endptr != '\0')
-#ifndef WIN32
- /*
- * On WIN32, errno is not thread-safe and GetLastError() isn't set by
- * strtoul(), so we can't check on this platform.
- */
- || errno == ERANGE
-#endif
- )
+ if (!endptr || (*endptr != ' ' && *endptr != '\0'))
return InvalidOid;
else
return (Oid) result;