public inbox for [email protected]
help / color / mirror / Atom feedFrom: =?ISO-8859-1?B?V2VpIFN1bg==?= <[email protected]>
To: =?ISO-8859-1?B?cGdzcWwtaGFja2Vycw==?= <[email protected]>
Subject: Add lasterrno setting for dir_existsfile()
Date: Mon, 10 Jan 2022 00:19:28 +0800
Message-ID: <[email protected]> (raw)
Hi,
Some time ago,the following patch clean up error handling in pg_basebackup's walmethods.c.
https://github.com/postgres/postgres/commit/248c3a9
This patch keep the error state in the DirectoryMethodData struct,
in most functions, the lasterrno is set correctly, but in function dir_existsfile(),
the lasterrno is not set when the file fails to open.
If this is a correction omission, I think this patch can fix this.
Cheers
Attachments:
[application/octet-stream] add_lasterrno_setting.patch (406B, ../[email protected]/3-add_lasterrno_setting.patch)
download | inline diff:
diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c
index f74bd13..35cf5a8 100644
--- a/src/bin/pg_basebackup/walmethods.c
+++ b/src/bin/pg_basebackup/walmethods.c
@@ -580,7 +580,10 @@ dir_existsfile(const char *pathname)
fd = open(tmppath, O_RDONLY | PG_BINARY, 0);
if (fd < 0)
+ {
+ dir_data->lasterrno = errno;
return false;
+ }
close(fd);
return true;
}
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Add lasterrno setting for dir_existsfile()
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox