From 856c3f306bbf6fac25c2b8a0642509e6518ccb07 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Tue, 13 May 2008 20:54:02 +0000 Subject: [PATCH] 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 --- src/backend/access/transam/xlog.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 20072fb0ff..35aeb57116 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3334,8 +3334,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; } -- 2.39.5