From 3fdc1d269345cac24275613f4d6b799e195d95a0 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 31 Oct 2023 11:59:14 -0400 Subject: [PATCH] C comment: mention why no setting lasterrno in dir_existsfile() Reported-by: Wei Sun Discussion: https://postgr.es/m/tencent_1276C08F98579CC19D8A4488C848A8411806@qq.com Backpatch-through: master --- src/bin/pg_basebackup/walmethods.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c index 2de11ce9b1c..33cb85b849e 100644 --- a/src/bin/pg_basebackup/walmethods.c +++ b/src/bin/pg_basebackup/walmethods.c @@ -594,6 +594,11 @@ dir_existsfile(WalWriteMethod *wwmethod, const char *pathname) fd = open(tmppath, O_RDONLY | PG_BINARY, 0); if (fd < 0) + + /* + * Skip setting dir_data->lasterrno here because we are only checking + * for existence. + */ return false; close(fd); return true;