[Date Prev][Date Next]
Re: sys_errlist deprecated? (ITS#3111)
Note that strerror_r() is not terrible portable.
The POSIX defn is:
int strerror_r(int errnum, char *strerrbuf, size_t buflen);
while some systems (like Linux) use:
char *strerror_r(int errnum, char *buf, size_t buflen);
and other systems one just uses strerrror() (which on these
systems uses a thread specific buffer unknown error numbers).
At 02:38 AM 4/24/2004, firstname.lastname@example.org wrote:
>Full_Name: Pierangelo Masarati
>OS: Linux, gcc >= 3.3
>Submission from: (NULL) (220.127.116.11)
>Submitted by: ando
>recent versions of gcc (>=3.3 or even earlier) complain about sys_errlist being
>deprecated. Since the direct use of sys_errlist was intended to safely provide
>error messages in a threaded environment, but the portability could be
>endangered by its deprecation, I'm patching HEAD code to use strerror_r(), as
>suggested by gcc, where available. This requires an API change because the
>(braindead?) interface of strerror_r() requires a buffer to be passed, but the
>buffer may or may not be used. Of course the code would remain as is if
>strerror_r() is not available; the sequence would be:
>strerror_r(); or sys_errlist; or strerror(); or "unknown"
>Would this change be considered worthy (I mean -- of general utility and