Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fcd1132

Browse files
committed
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
1 parent e578c17 commit fcd1132

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/port/win32stat.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ _pgstat64(const char *name, struct stat *buf)
204204
NULL);
205205
if (hFile == INVALID_HANDLE_VALUE)
206206
{
207+
DWORD err = GetLastError();
208+
207209
CloseHandle(hFile);
208-
errno = ENOENT;
210+
_dosmaperr(err);
209211
return -1;
210212
}
211213

0 commit comments

Comments
 (0)