postgres.git / summary / log / commit / refs
commit fcd11329db5bca9993207f099a642a7d1cd59ff8
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon Oct 12 15:13:02 2020 +0000
First released in: 14.0
Minor cleanup for win32stat.c.
Use GetLastError(), rather than assuming that CreateFile() failure
must map to ENOENT. Noted by Michael Paquier.
Discussion: https://postgr.es/m/CAC+AXB0g44SbvSpC86o_1HWh8TAU2pZrMRW6tJT-dkijotx5Qg@mail.gmail.com
src/port/win32stat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/port/win32stat.c b/src/port/win32stat.c
index d4315c44f4d..9051c713e7b 100644
--- a/src/port/win32stat.c
+++ b/src/port/win32stat.c
@@ -204,8 +204,10 @@ _pgstat64(const char *name, struct stat *buf)
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
+ DWORD err = GetLastError();
+
CloseHandle(hFile);
- errno = ENOENT;
+ _dosmaperr(err);
return -1;
}
[parent: e578c17d8166]