Even though POSIX/XSI requires "strerror_r" to return an "int", some systems
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Fri, 6 Mar 2009 05:39:37 +0000 (05:39 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Fri, 6 Mar 2009 05:39:37 +0000 (05:39 +0000)
commit7002f39fe85f0d540dd97659f18ca5347bef90f1
treeff5dda0b2054c16cd849064b53ed0bfb7bf6818d
parentadced9c3ee51a50a65f6ea255a6017dff856a78b
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>.

patch by Sebastian Harl

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1752 a5681a0c-68f1-0310-ab6d-d61299d08faa
configure.ac
src/rrd_thread_safe.c