pgsql: Fix incorrect errno in OpenWalSummaryFile()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix incorrect errno in OpenWalSummaryFile()
Date: 2026-02-03 02:25:43
Message-ID: E1vn66p-000pND-0R@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix incorrect errno in OpenWalSummaryFile()

This routine has an option to bypass an error if a WAL summary file is
opened for read but is missing (missing_ok=true). However, the code
incorrectly checked for EEXIST, that matters when using O_CREAT and
O_EXCL, rather than ENOENT, for this case.

There are currently only two callers of OpenWalSummaryFile() in the
tree, and both use missing_ok=false, meaning that the check based on the
errno is currently dead code. This issue could matter for out-of-core
code or future backpatches that would like to use missing_ok set to
true.

Issue spotted while monitoring this area of the code, after
a9afa021e95f.

Author: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/aYAf8qDHbpBZ3Rml@paquier.xyz
Backpatch-through: 17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3b15032dad50d18e45cf12070af13035bd1f2fe9

Modified Files
--------------
src/backend/backup/walsummary.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-02-03 03:27:44 pgsql: Add two IO wait events for COPY FROM/TO on a pipe/file/program
Previous Message Fujii Masao 2026-02-03 02:15:04 pgsql: Release synchronous replication waiters immediately on configura