From: Magnus Hagander Date: Tue, 13 May 2008 20:54:02 +0000 (+0000) Subject: Don't try to close negative file descriptors, since this can cause X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=3613400e47893ace13a3d0d04a76159b35c9909e;p=users%2Fbernd%2Fpostgres.git 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 --- diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 67541fce24..e43cf467fa 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -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; }