Re: Add lasterrno setting for dir_existsfile()

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Add lasterrno setting for dir_existsfile()
Дата
Msg-id YvbcbLub4Ph54/Mi@momjian.us
обсуждение исходный текст
Ответ на Re: Add lasterrno setting for dir_existsfile()  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Add lasterrno setting for dir_existsfile()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
On Fri, Aug 12, 2022 at 06:22:01PM -0400, Bruce Momjian wrote:
> On Mon, Jan 10, 2022 at 12:19:28AM +0800, Wei Sun wrote:
> > Hi,
> > 
> > Some time ago,the following patch clean up error handling in pg_basebackup's
> > walmethods.c.
> > https://github.com/postgres/postgres/commit/248c3a9
> > 
> > This patch keep the error state in the DirectoryMethodData struct,
> > in most functions, the lasterrno is set correctly, but in function
> > dir_existsfile(), 
> > the lasterrno is not set when the file fails to open.
> > 
> > If this is a correction omission, I think this patch can fix this.
> 
> Looking at this, the function is used to check if something exists, and
> return a boolean. I am not sure it is helpful to also return a ENOENT in
> the lasterrno status field.  It might be useful to set lasterrno if the
> open fails and it is _not_ ENOENT.

Thinking some more, how would you know to check lasterrno since exists
and not exists are both valid outputs?

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Cleaning up historical portability baggage
Следующее
От: Junwang Zhao
Дата:
Сообщение: Re: fix stale help message