Re: Fix some error handling for read() and errno
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org, tgl@sss.pgh.pa.us, magnus@hagander.net, hlinnaka@iki.fi
Date: 2018-05-25T07:04:58Z
Lists: pgsql-hackers
Attachments
- read-errno-handling-v3.patch (text/x-diff) patch v3
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
Commits
-
Rework error messages around file handling
- 811b6e36a9e2 12.0 landed