mirror of
https://github.com/postgres/postgres.git
synced 2026-06-10 09:10:33 -04:00
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
a9afa021e9.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aYAf8qDHbpBZ3Rml@paquier.xyz
Backpatch-through: 17
This commit is contained in:
parent
5995135f13
commit
3b15032dad
1 changed files with 1 additions and 1 deletions
|
|
@ -214,7 +214,7 @@ OpenWalSummaryFile(WalSummaryFile *ws, bool missing_ok)
|
|||
LSN_FORMAT_ARGS(ws->end_lsn));
|
||||
|
||||
file = PathNameOpenFile(path, O_RDONLY);
|
||||
if (file < 0 && (errno != EEXIST || !missing_ok))
|
||||
if (file < 0 && (errno != ENOENT || !missing_ok))
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not open file \"%s\": %m", path)));
|
||||
|
|
|
|||
Loading…
Reference in a new issue