Re: Return value of PathNameOpenFile()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Return value of PathNameOpenFile()
Date: 2022-09-06 14:12:42
Message-ID: 3149754.1662473562@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> Agreed, zero should be valid as it's a non-negative integer. However, callers
> in fd.c are themselves checking for (fd <= 0) in some cases, and some have done
> so since the very early days of the codebase, so I wonder if there historically
> used to be a platform which considered 0 an invalid fd?

I'm betting it's a thinko that never got caught because 0 would
always be taken up by stdin. Maybe you'd notice if you tried to
close-and-reopen stdin, but that's not something the server ever does.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-09-06 14:21:23 Re: (doc patch) psql version compatibility
Previous Message Masahiko Sawada 2022-09-06 14:10:04 Re: pgsql: Add ALTER SUBSCRIPTION ... SKIP.