aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2008-05-13 20:54:02 +0000
committerMagnus Hagander <magnus@hagander.net>2008-05-13 20:54:02 +0000
commit53397b1e68093555e2dc4aa0736d71358883d052 (patch)
tree0d9a648859e5e9b27b790114365f1cee861db71a
parentf496eb31b27856570eb62c16c00b0717fb0b63e7 (diff)
downloadpostgresql-53397b1e68093555e2dc4aa0736d71358883d052.tar.gz
postgresql-53397b1e68093555e2dc4aa0736d71358883d052.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 75faf541368..a3b236ccec2 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.292.2.3 2008/05/09 15:28:01 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.292.2.4 2008/05/13 20:54:02 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3317,8 +3317,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;
}