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

Commiteda5e90

Browse files
committed
Don't trust CreateFileMapping() to clear the error code on success.
We must test GetLastError() even when CreateFileMapping() returns anon-null handle. If that value were left over from some previous systemcall, we might be fooled into thinking the segment already existed.Experimentation on Windows 7 suggests that CreateFileMapping() clearsthe error code on success, but it is not documented to do so, so let'snot rely on that happening in all Windows releases.Amit KapilaDiscussion: <20811.1474390987@sss.pgh.pa.us>
1 parent93528f7 commiteda5e90

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/storage/ipc/dsm_impl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,9 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
681681
#endif
682682
size_low= (DWORD)request_size;
683683

684+
/* CreateFileMapping might not clear the error code on success */
685+
SetLastError(0);
686+
684687
hmap=CreateFileMapping(INVALID_HANDLE_VALUE,/* Use the pagefile */
685688
NULL,/* Default security attrs */
686689
PAGE_READWRITE,/* Memory is read/write */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp