Fix some error handling for read() and errno - Mailing list pgsql-hackers

From Michael Paquier
Subject Fix some error handling for read() and errno
Date
Msg-id 20180520000522.GB1603@paquier.xyz
Whole thread Raw
Responses Re: Fix some error handling for read() and errno
List pgsql-hackers
Hi all,

This is basically a new thread after what has been discussed for
pg_controldata with its error handling for read():
https://www.postgresql.org/message-id/CABUevEx8ZRV5Ut_FvP2etXiQppx3xVzm7oOaV3AcdHxX81Yt8Q%40mail.gmail.com

While reviewing the core code, I have noticed similar weird error
handling for read().  At the same time, some of those places may use an
incorrect errno, as an error is invoked using an errno which may be
overwritten by another system call.  I found a funny one in slru.c,
for which I have added a note in the patch.  I don't think that this is
worth addressing with more facility, thoughts are welcome.

Attached is a patch addressing the issues I found.

Thanks,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Fix for FETCH FIRST syntax problems
Next
From: Andrew Gierth
Date:
Subject: Re: Fix for FETCH FIRST syntax problems