Re: Replace open mode with PG_BINARY_R/W/A macros - Mailing list pgsql-hackers

From Japin Li
Subject Re: Replace open mode with PG_BINARY_R/W/A macros
Date
Msg-id MEYP282MB16693D20326B896FDDE4F3C4B6F79@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: Replace open mode with PG_BINARY_R/W/A macros  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Replace open mode with PG_BINARY_R/W/A macros  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, 22 Apr 2022 at 04:38, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter.eisentraut@enterprisedb.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.



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: More problems with VacuumPageHit style global variables
Next
From: Yugo NAGATA
Date:
Subject: Re: Implementing Incremental View Maintenance