aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-10-12 11:13:02 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-10-12 11:13:02 -0400
commitfcd11329db5bca9993207f099a642a7d1cd59ff8 (patch)
tree6b9b314946d9457c98a93ec8034286e6f8179e07
parente578c17d81662b4f4f63a2797bc1be64af3c8f93 (diff)
downloadpostgresql-fcd11329db5bca9993207f099a642a7d1cd59ff8.tar.gz
postgresql-fcd11329db5bca9993207f099a642a7d1cd59ff8.zip
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
-rw-r--r--src/port/win32stat.c4
1 files changed, 3 insertions, 1 deletions
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;
}