Re: Safeguards against incorrect fd flags for fsync()

Michael Banck <mbanck@gmx.net>

From: Michael Banck <mbanck@gmx.net>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-06-10T21:09:31Z
Lists: pgsql-hackers
Hi,

one more thing:

On Tue, Jun 10, 2025 at 12:26:48PM +0200, Michael Banck wrote:
> The better way might be to mask the flags with O_ACCMODE and then just
> check what you want, like in the attached.

I forgot to mention it in the patch, but Samuel Thibault reviewed the
patch and suggested improvements to the point where he should probably
be credited as co-author but at least as reviewer should this be
accepted.


Michael



Commits

  1. Make safeguard against incorrect flags for fsync more portable.

  2. Add safeguards for pg_fsync() called with incorrectly-opened fds