Re: Improved fix for sys_nerr - Mailing list pgsql-patches

From Peter Eisentraut
Subject Re: Improved fix for sys_nerr
Date
Msg-id Pine.LNX.4.21.0010272057530.838-100000@peter.localdomain
Whole thread Raw
In response to Re: Improved fix for sys_nerr  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane writes:

> I recommend adding a configure test to see whether sys_nerr exists,
> and trusting strerror() to be bulletproof only where it does not.
>
> As you say, there could be holes in the error number assignment,
> so an additional test for NULL result from strerror() seems wise.

Definitely a good plan.  If someone wants to be really dilligent he could
write up a "pgstrerror", which

1. does the str_nerr check if it exists
2. runs strerror(errno)
3. checks for NULL or EINVAL
4. returns something useful

You put that into src/utils and link it into every program or library that
uses strerror.

Any reasonable subset of this solution would be fine as well. :)

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Improved fix for sys_nerr
Next
From: Pete Forman
Date:
Subject: Re: Improved fix for sys_nerr