aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2008-05-13 20:53:58 +0000
committerMagnus Hagander <magnus@hagander.net>2008-05-13 20:53:58 +0000
commit5b4150a682e5093d9b5a609f5a4f51ed6d799cf7 (patch)
tree3719c8262415833d5d9ac56ab61f822f2969914e
parent6f28e879dd8630187b7640096978839ed204ce21 (diff)
downloadpostgresql-5b4150a682e5093d9b5a609f5a4f51ed6d799cf7.tar.gz
postgresql-5b4150a682e5093d9b5a609f5a4f51ed6d799cf7.zip
Don't try to close negative file descriptors, since this can cause
crashes on certain platforms. In particular, the MSVC runtime is known to do this. Fixes bug #4162, reported and diagnosed by Javier Pimas
-rw-r--r--src/backend/access/transam/xlog.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 8ce08bcdec3..6ba56a58ca3 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.222.2.6 2007/09/29 01:36:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.222.2.7 2008/05/13 20:53:58 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2934,8 +2934,11 @@ got_record:;
return (XLogRecord *) buffer;
next_record_is_invalid:;
- close(readFile);
- readFile = -1;
+ if (readFile >= 0)
+ {
+ close(readFile);
+ readFile = -1;
+ }
nextRecord = NULL;
return NULL;
}