pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make safeguard against incorrect flags for fsync more portable.
Date: Tue, 01 Jul 2025 16:09:12 +0000
Message-ID: <E1uWdXj-004DHh-38@gemulon.postgresql.org> (raw)

Make safeguard against incorrect flags for fsync more portable.

The existing code assumed that O_RDONLY is defined as 0, but this is
not required by POSIX and is not true on GNU Hurd.  We can avoid
the assumption by relying on O_ACCMODE to mask the fcntl() result.
(Hopefully, all supported platforms define that.)

Author: Michael Banck <mbanck@gmx.net>
Co-authored-by: Samuel Thibault
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6862e8d1.050a0220.194b8d.76fa@mx.google.com
Discussion: https://postgr.es/m/68480868.5d0a0220.1e214d.68a6@mx.google.com
Backpatch-through: 13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/29213636e6cddcb7b2c877bff8cb9ba470d392db

Modified Files
--------------
src/backend/storage/file/fd.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)



view thread (7+ messages)

Message-ID: <E1uWdXj-004DHh-38@gemulon.postgresql.org>
Permalink:  ../E1uWdXj-004DHh-38@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uWdXj-004DHh-38@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make safeguard against incorrect flags for fsync more portable.
  In-Reply-To: <E1uWdXj-004DHh-38@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox