From: Magnus Hagander Date: Tue, 13 May 2008 20:53:58 +0000 (+0000) Subject: Don't try to close negative file descriptors, since this can cause X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=da56f4cb98e46660af57bfddfc043876c9fa0c9b;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 fb958cc7ee..288936eb65 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2934,8 +2934,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; }