summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagnus Hagander2008-05-13 20:53:56 +0000
committerMagnus Hagander2008-05-13 20:53:56 +0000
commit8e30db83a5b87b2d812d238674d5e5615f700dc1 (patch)
tree317afc7711798870c44e599a0419a2269e5c5387 /src
parent98bf4226256d5d745001dfe421856e69dee23754 (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
Diffstat (limited to 'src')
-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 537af81fcfa..342d37311ee 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.180.4.6 2007/09/29 01:36:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.180.4.7 2008/05/13 20:53:56 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2671,8 +2671,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;
}