Re: Fix fseek() detection of unseekable files on WIN32 - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Fix fseek() detection of unseekable files on WIN32
Date
Msg-id ZBbv+wfxsAXI4mqc@paquier.xyz
Whole thread Raw
In response to Re: Fix fseek() detection of unseekable files on WIN32  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Responses Re: Fix fseek() detection of unseekable files on WIN32  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Thu, Mar 16, 2023 at 10:08:44AM +0100, Juan José Santamaría Flecha wrote:
> IDK, this is just looking for the good case, anything else we'll fail with
> ESPIPE or EINVAL anyway. If we want to get the proper file type we can call
> fstat(), which has the full logic.

I am not sure, TBH.  As presented, the two GetFileType() calls in
_pgftello64() and _pgfseeko64() ignore the case where it returns
FILE_TYPE_UNKNOWN and GetLastError() has something else than
NO_ERROR.  The code would return EINVAL for all the errors happening.
Perhaps that's fine, though I am wondering if we should report
something more exact, based on _dosmaperr(GetLastError())?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michail Nikolaev
Date:
Subject: Replace known_assigned_xids_lck by memory barrier
Next
From: Jeevan Ladhe
Date:
Subject: server log inflates due to pg_logical_slot_peek_changes/pg_logical_slot_get_changes calls