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 <mba...@gmx.net> Co-authored-by: Samuel Thibault Reviewed-by: Tom Lane <t...@sss.pgh.pa.us> Discussion: https://postgr.es/m/6862e8d1.050a0220.194b8d.7...@mx.google.com Discussion: https://postgr.es/m/68480868.5d0a0220.1e214d.6...@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(-)