Re: More consistency for some file-related error message

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Date: 2018-07-19T03:24:05Z
Lists: pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Jul 18, 2018 at 10:57:16AM -0400, Tom Lane wrote:
>> BTW, isn't the initial "errno = 0" dead code now?

> Hm.  I have not bothered touching those as it could be possible that
> read() may not initialize errno to 0, so errno would remain set to any
> previous value when less bytes than expected are read, no?  It seems to
> me that the current coding is more careful.

read() is required by spec to set errno when returning a negative result.
I think the previous coding paid attention to errno regardless of the sign
of the result, which would justify pre-zeroing it ... but the new coding
definitely doesn't.

			regards, tom lane


Commits

  1. Add proper errcodes to new error messages for read() failures

  2. Make more consistent some error messages for file-related operations