diff options
| author | Tom Lane | 2020-10-12 15:13:02 +0000 |
|---|---|---|
| committer | Tom Lane | 2020-10-12 15:13:02 +0000 |
| commit | fcd11329db5bca9993207f099a642a7d1cd59ff8 (patch) | |
| tree | 6b9b314946d9457c98a93ec8034286e6f8179e07 /src | |
| parent | e578c17d81662b4f4f63a2797bc1be64af3c8f93 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/port/win32stat.c | 4 |
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; } |
