Re: Fix fseek() detection of unseekable files on WIN32
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2023-03-16T01:05:52Z
Lists: pgsql-hackers
On Wed, Mar 15, 2023 at 12:18:25PM +0100, Juan José Santamaría Flecha wrote:
> PFA a new version of the patch.
+_pgftello64(FILE *stream)
+{
+ DWORD fileType;
+
+ fileType = GetFileType((HANDLE) _get_osfhandle(_fileno(stream)));
Hmm. I am a bit surprised here.. It seems to me that we should make
sure that:
- We exist quickly if _get_osfhandle() returns -2 or
INVALID_HANDLE_VALUE, returning EINVAL?
- After GetFileType(), check for GetLastError() and the
FILE_TYPE_UNKNOWN case?
Do you think that these would be improvements?
--
Michael
Commits
-
Fix detection of unseekable files for fseek() and ftello() with MSVC
- 34105eea62e1 14.8 landed
- 5c32549460fc 15.3 landed
- a923e21631a2 16.0 landed