C comment: mention why no setting lasterrno in dir_existsfile()
authorBruce Momjian <[email protected]>
Tue, 31 Oct 2023 15:59:14 +0000 (11:59 -0400)
committerBruce Momjian <[email protected]>
Tue, 31 Oct 2023 15:59:14 +0000 (11:59 -0400)
Reported-by: Wei Sun
Discussion: https://postgr.es/m/[email protected]

Backpatch-through: master

src/bin/pg_basebackup/walmethods.c

index 2de11ce9b1c45c8ab4db15855a25eea03e01ac87..33cb85b849ea3f4efb2b1625daaff523d0aa0b0f 100644 (file)
@@ -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;