summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2008-05-13 20:54:00 +0000
committerMagnus Hagander <magnus@hagander.net>2008-05-13 20:54:00 +0000
commit9b1e598edb039c56e81537fffb78ab7b54960b45 (patch)
tree4868a36bf733662d24880585623ea9119034ad7a
parent5b12b1c3770ab8ceb072db993d1ad88fffcd40d9 (diff)
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 3f9383e8697..77d254ccd41 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.258.2.3 2008/04/17 00:00:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.258.2.4 2008/05/13 20:54:00 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3223,8 +3223,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;
}