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

Commitc23851b

Browse files
committed
Paranoia about possible values of errno after a shmget/semget failure.
In theory we should always get EEXIST if there's a key collision, butif the kernel code tests error conditions in a weird order, perhapsEACCES or EIDRM could occur too.
1 parent2153d1c commitc23851b

File tree

1 file changed

+15
-5
lines changed
  • src/backend/storage/ipc

1 file changed

+15
-5
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.57 2000/12/11 00:49:52 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.58 2000/12/30 01:20:55 tgl Exp $
1212
*
1313
* NOTES
1414
*
@@ -272,9 +272,14 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
272272
/*
273273
* Fail quietly if error indicates a collision with existing set.
274274
* One would expect EEXIST, given that we said IPC_EXCL, but perhaps
275-
* we could get a permission violation instead?
275+
* we could get a permission violation instead? Also, EIDRM might
276+
* occur if an old set is slated for destruction but not gone yet.
276277
*/
277-
if (errno==EEXIST||errno==EACCES)
278+
if (errno==EEXIST||errno==EACCES
279+
#ifdefEIDRM
280+
||errno==EIDRM
281+
#endif
282+
)
278283
return-1;
279284
/*
280285
* Else complain and abort
@@ -516,9 +521,14 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
516521
/*
517522
* Fail quietly if error indicates a collision with existing segment.
518523
* One would expect EEXIST, given that we said IPC_EXCL, but perhaps
519-
* we could get a permission violation instead?
524+
* we could get a permission violation instead? Also, EIDRM might
525+
* occur if an old seg is slated for destruction but not gone yet.
520526
*/
521-
if (errno==EEXIST||errno==EACCES)
527+
if (errno==EEXIST||errno==EACCES
528+
#ifdefEIDRM
529+
||errno==EIDRM
530+
#endif
531+
)
522532
returnNULL;
523533
/*
524534
* Else complain and abort

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp