diff options
author | Magnus Hagander <magnus@hagander.net> | 2008-05-13 20:53:54 +0000 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2008-05-13 20:53:54 +0000 |
commit | 7cff884c3882114b777d3ce84439a4ce3b280a17 (patch) | |
tree | 4525bf6e3e725a97443b47a1fb5675d00b3cccad | |
parent | 7baef60c8b6b178f43379810b1cb89664905208a (diff) | |
download | postgresql-7cff884c3882114b777d3ce84439a4ce3b280a17.tar.gz postgresql-7cff884c3882114b777d3ce84439a4ce3b280a17.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.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 5a102750750..873e4505711 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.125.2.4 2006/01/05 00:55:23 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.125.2.5 2008/05/13 20:53:54 mha Exp $ * *------------------------------------------------------------------------- */ @@ -2056,8 +2056,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; } |