aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2009-05-04 08:36:42 +0000
committerMagnus Hagander <magnus@hagander.net>2009-05-04 08:36:42 +0000
commitf79ea3da647cbbef9b88760f463f5a73693328d5 (patch)
tree64bb801fb5fca6a1a1a977b86ce0ac90437e604d /src
parent4c3c2ee8aa21514e50146daa1e8ba35b1a14e32d (diff)
downloadpostgresql-f79ea3da647cbbef9b88760f463f5a73693328d5.tar.gz
postgresql-f79ea3da647cbbef9b88760f463f5a73693328d5.zip
Call SetLastError(0) before calling the file mapping functions
to make sure that the error code is reset, as a precaution in case the API doesn't properly reset it on success. This could be necessary, since we check the error value even if the function doesn't fail for specific success cases.
Diffstat (limited to 'src')
-rw-r--r--src/backend/port/win32/shmem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/port/win32/shmem.c b/src/backend/port/win32/shmem.c
index 6f7a661d4e3..c7865bda325 100644
--- a/src/backend/port/win32/shmem.c
+++ b/src/backend/port/win32/shmem.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/shmem.c,v 1.13 2006/07/14 05:28:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/shmem.c,v 1.13.2.1 2009/05/04 08:36:42 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,6 +90,7 @@ shmget(int memKey, int size, int flag)
if (flag & IPC_CREAT)
{
+ SetLastError(0);
hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the swap file */
NULL,
PAGE_READWRITE, /* Memory is Read/Write */
@@ -99,6 +100,7 @@ shmget(int memKey, int size, int flag)
}
else
{
+ SetLastError(0);
hmap = OpenFileMapping(FILE_MAP_ALL_ACCESS,
FALSE,
szShareMem);