Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitca6c0ac

Browse files
committed
Call SetLastError(0) before calling the file mapping functions
to make sure that the error code is reset, as a precaution incase the API doesn't properly reset it on success. This couldbe necessary, since we check the error value even if the functiondoesn't fail for specific success cases.
1 parentffbd17e commitca6c0ac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/port/win32_shmem.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.7 2009/01/01 17:23:46 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.8 2009/05/04 08:36:40 mha Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -131,6 +131,9 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
131131

132132
UsedShmemSegAddr=NULL;
133133

134+
/* In case CreateFileMapping() doesn't set the error code to 0 on success */
135+
SetLastError(0);
136+
134137
hmap=CreateFileMapping((HANDLE)0xFFFFFFFF,/* Use the pagefile */
135138
NULL,/* Default security attrs */
136139
PAGE_READWRITE,/* Memory is Read/Write */
@@ -160,6 +163,9 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
160163

161164
Sleep(1000);
162165

166+
/* In case CreateFileMapping() doesn't set the error code to 0 on success */
167+
SetLastError(0);
168+
163169
hmap=CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE,0L, (DWORD)size,szShareMem);
164170
if (!hmap)
165171
ereport(FATAL,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp