Re: More consistency for some file-related error message - Mailing list pgsql-hackers

From Tom Lane
Subject Re: More consistency for some file-related error message
Date
Msg-id 21605.1531970645@sss.pgh.pa.us
Whole thread Raw
In response to Re: More consistency for some file-related error message  (Michael Paquier <michael@paquier.xyz>)
Responses Re: More consistency for some file-related error message  (Michael Paquier <michael@paquier.xyz>)
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Have an encrypted pgpass file
Next
From: Michael Paquier
Date:
Subject: Re: More consistency for some file-related error message