git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 39725e5)
After closing frontend socket, set MyProcPort->sock = -1 to ensure that
2000年5月26日 01:26:19 +0000 (01:26 +0000)
2000年5月26日 01:26:19 +0000 (01:26 +0000)
subsequent I/O attempts fail cleanly. I'm speculating about failure
scenarios in which we do pq_close, then something in a proc_exit routine
opens a file (re-using that kernel FD number), then something else
fails and tries to write an elog message to the frontend ... message
ends up in opened file, oops. No known examples of this but it seems
like a potential hole.


diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index aec4f34c7d20d9a333a506ec0e083b7e7dac0916..a7d757066e89bdc3970efd2d78226b3b1efaab37 100644 (file)
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -29,7 +29,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.91 2000年05月21日 21:19:53 tgl Exp $
+ * $Id: pqcomm.c,v 1.92 2000年05月26日 01:26:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -144,7 +144,11 @@ void
pq_close(void)
{
if (MyProcPort != NULL)
+ {
close(MyProcPort->sock);
+ /* make sure any subsequent attempts to do I/O fail cleanly */
+ MyProcPort->sock = -1;
+ }
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /