Re: Fix some error handling for read() and errno

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Fix some error handling for read() and errno
Дата
Msg-id 20180525070458.GC15634@paquier.xyz
обсуждение исходный текст
Ответ на Re: Fix some error handling for read() and errno  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Ответы Re: Fix some error handling for read() and errno  (Robbie Harwood <rharwood@redhat.com>)
Список pgsql-hackers
On Fri, May 25, 2018 at 01:19:58PM +0900, Kyotaro HORIGUCHI wrote:
> The case is not of an empty file. read() reads 0 bytes without
> error while lseek have told that the file has *more* data. I
> don't think that can happen. How about just commenting with
> something like the following?

Actually it can be useful to report that no data has been read and that
more data was expected, like that:
+       else if (nread == 0)
+           ereport(ERROR,
+                   (errmsg("no data read from file \"%s\": expected %zu more bytes",
+                           path, bytesleft)));
--
Michael

Вложения

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

Предыдущее
От: Arseny Sher
Дата:
Сообщение: Re: Possible bug in logical replication.
Следующее
От: Arseny Sher
Дата:
Сообщение: Re: Fix slot's xmin advancement and subxact's lost snapshots in decoding.