Fix bug in the test of file descriptor of current WAL file in pg_receivexlog.
authorFujii Masao
Wed, 19 Nov 2014 10:11:03 +0000 (19:11 +0900)
committerFujii Masao
Wed, 19 Nov 2014 10:11:03 +0000 (19:11 +0900)
In pg_receivexlog, in order to check whether the current WAL file is
being opened or not, its file descriptor has to be checked against -1
as an invalid value. But, oops, 7900e94 added the incorrect test
checking the descriptor against 1. This commit fixes that bug.

Back-patch to 9.4 where the bug was added.

Spotted by Magnus Hagander

src/bin/pg_basebackup/receivelog.c

index 48a34cb5546876236bf026d429d792b3b6222184..0878809f7b7e98dd297ef49874271b27e3cc9102 100644 (file)
@@ -919,7 +919,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
            if (replyRequested && still_sending)
            {
                if (reportFlushPosition && lastFlushPosition < blockpos &&
-                   walfile != 1)
+                   walfile != -1)
                {
                    /*
                     * If a valid flush location needs to be reported,