diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 9e45976179788c62f9461efb1932c5c0874e7ad6..e5dddd4751b2edd9f4e4f579ce609b7abaa22775 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5043,8 +5043,15 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog) else { bool use_existent = true; + int fd; - XLogFileInit(startLogSegNo, &use_existent, true); + fd = XLogFileInit(startLogSegNo, &use_existent, true); + + if (close(fd)) + ereport(ERROR, + (errcode_for_file_access(), + errmsg("could not close log file %s: %m", + XLogFileNameP(ThisTimeLineID, startLogSegNo)))); } /*