[rrd-developers] [PATCH] Fixed and improved error reporting using strerror_r().

Tobias Oetiker tobi at oetiker.ch
Fri Mar 6 06:41:09 CET 2009

Hi Sebastian,

Feb 13 Sebastian Harl wrote:

> Even though POSIX/XSI requires "strerror_r" to return an "int", some systems
> (e.g. the GNU libc) return a "char *" _and_ ignore the second argument (user
> provided buffer). The configure script now checks for that behavior using
> AC_FUNC_STRERROR_R. rrd_strerror() in rrd_thread_safe.c has been updated to
> (hopefully) handle all possible cases.
> Previously, rrd_strerror() would have returned "strerror_r failed. sorry!" in
> mostly any cases when using glibc, since "if (strerror_r())" had been used to
> check for errors which evaluates to true if a (non-NULL) pointer was returned.
> Now, we, at least, return the error number in case anything else fails.
> Thanks to Alessandro Iurlano for reporting this issue after spotting it in
> collectd <http://collectd.org>.
> ---
> Damn ... I just spotted an error in the ! STRERROR_R_CHAR_P case
> (assigning ctx->lib_errstr to ret) - please consider this patch instead.

wow ... cool thanks ... patch is in.


Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900

More information about the rrd-developers mailing list