errmsg() clobbers errno - Mailing list pgsql-hackers

From John Gorman
Subject errmsg() clobbers errno
Date
Msg-id CALkS6B9AH00MJmmKd78deaFwtc=JfYbsDXvq0kjyR0J9pX2Xkw@mail.gmail.com
Whole thread Raw
Responses Re: errmsg() clobbers errno  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi All

While debugging an extension I discovered that the errmsg()
function zeros out errno.

This is annoying because if the process of assembling a meaningful
error message happens to call errmsg() before calling strerror()
we lose the strerror information. This is exactly the time when we
want to preserve any available error state.

I am attaching a patch to preserve errno across errmsg() calls.

Does this seem like a good idea?

Best, John
Attachment

pgsql-hackers by date:

Previous
From: Geoff Winkless
Date:
Subject: Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint
Next
From: Tom Lane
Date:
Subject: Re: Wrong Assert in PageIndexMultiDelete?