Re: Improved fix for sys_nerr

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pete Forman <gsez020(at)kryten(dot)bedford(dot)waii(dot)com>, pgsql-patches(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: Improved fix for sys_nerr
Date: 2000-10-27 19:00:37
Message-ID: Pine.LNX.4.21.0010272057530.838-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2000-10-28 18:26:39 Re: Beos updates
Previous Message Pete Forman 2000-10-27 11:19:05 Re: Improved fix for sys_nerr