Re: Replace open mode with PG_BINARY_R/W/A macros

From: Japin Li <japinli(at)hotmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Replace open mode with PG_BINARY_R/W/A macros
Date: 2022-04-22 01:51:03
Message-ID: MEYP282MB16693D20326B896FDDE4F3C4B6F79@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Fri, 22 Apr 2022 at 04:38, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> writes:
>> On 20.04.22 22:29, Tom Lane wrote:
>>> PG_BINARY is useful for open(). It's the PG_BINARY_R/W/A macros for
>>> fopen() that are redundant per POSIX. Possibly someone generalized
>>> inappropriately; or maybe long ago we supported some platform that
>>> rejected the "b" option?
>
>> I think the latter was the case. I doubt it's still a problem.
>
> We could find that out with little effort, at least for machines in the
> buildfarm, by modifying c.h to use the form with "b" always.
>

I think we should also consider the popen() (see: OpenPipeStream() function),
on the Windows, it can use "b", however, for linux, it might be not right.
So, modifying c.h to use the form with "b" isn't always right.

[1] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/popen-wpopen?view=msvc-170

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo NAGATA 2022-04-22 02:29:39 Re: Implementing Incremental View Maintenance
Previous Message Peter Geoghegan 2022-04-21 23:53:08 Re: More problems with VacuumPageHit style global variables