Re: BUG #15858: could not stat file - over 4GB
Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
From: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Emil Iggland <emil@iggland.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-10-10T14:29:38Z
Lists: pgsql-bugs, pgsql-hackers
On Sat, Oct 10, 2020 at 2:24 PM Michael Paquier <michael@paquier.xyz> wrote: > > - _dosmaperr(GetLastError()); > + DWORD err = GetLastError(); > + > + /* report when not ERROR_SUCCESS */ > + if (err == ERROR_FILE_NOT_FOUND || err == > ERROR_PATH_NOT_FOUND) > + errno = ENOENT; > + else > + _dosmaperr(err); > Why are you changing that? The original coding is fine, as > _dosmaperr() already maps ERROR_FILE_NOT_FOUND and > ERROR_PATH_NOT_FOUND to ENOENT. > If the file does not exist there is no need to call _dosmaperr() and log the error. > > - _dosmaperr(GetLastError()); > + DWORD err = GetLastError(); > + > CloseHandle(hFile); > + _dosmaperr(err); > These parts are indeed incorrect. CloseHandle() could overwrite > errno. > The meaningful error should come from the previous call, and an error from CloseHandle() could mask it. Not sure it makes a difference anyhow. Regards, Juan José Santamaría Flecha
Commits
-
Minor cleanup for win32stat.c.
- fcd11329db5b 14.0 landed
- 961e07b8ccb5 14.0 landed
- c94cfb38c32a 14.0 landed
-
plperl.h should #undef fstat along with stat and lstat.
- ed30b1a60dad 14.0 cited
-
Fix our Windows stat() emulation to handle file sizes > 4GB.
- bed90759fcbc 14.0 landed