aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-12-30 01:20:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-12-30 01:20:55 +0000
commitc23851bbe060983cb688afbd9708602fc70fd1d0 (patch)
tree98205c3910bb711e66fa35dbe1174415b943fa48 /src
parent2153d1c1062fb8ee363fb186c3cbb2d8533528ba (diff)
downloadpostgresql-c23851bbe060983cb688afbd9708602fc70fd1d0.tar.gz
postgresql-c23851bbe060983cb688afbd9708602fc70fd1d0.zip
Paranoia about possible values of errno after a shmget/semget failure.
In theory we should always get EEXIST if there's a key collision, but if the kernel code tests error conditions in a weird order, perhaps EACCES or EIDRM could occur too.
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/ipc/ipc.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index ee1bd7aeab1..b111e65cb06 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.57 2000/12/11 00:49:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.58 2000/12/30 01:20:55 tgl Exp $
*
* NOTES
*
@@ -272,9 +272,14 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
/*
* Fail quietly if error indicates a collision with existing set.
* One would expect EEXIST, given that we said IPC_EXCL, but perhaps
- * we could get a permission violation instead?
+ * we could get a permission violation instead? Also, EIDRM might
+ * occur if an old set is slated for destruction but not gone yet.
*/
- if (errno == EEXIST || errno == EACCES)
+ if (errno == EEXIST || errno == EACCES
+#ifdef EIDRM
+ || errno == EIDRM
+#endif
+ )
return -1;
/*
* Else complain and abort
@@ -516,9 +521,14 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission)
/*
* Fail quietly if error indicates a collision with existing segment.
* One would expect EEXIST, given that we said IPC_EXCL, but perhaps
- * we could get a permission violation instead?
+ * we could get a permission violation instead? Also, EIDRM might
+ * occur if an old seg is slated for destruction but not gone yet.
*/
- if (errno == EEXIST || errno == EACCES)
+ if (errno == EEXIST || errno == EACCES
+#ifdef EIDRM
+ || errno == EIDRM
+#endif
+ )
return NULL;
/*
* Else complain and abort