[rrd-developers] Improvements to rrd_strerror.

Florian Forster rrdtool at nospam.verplant.org
Thu Feb 12 15:35:05 CET 2009


Hi Tobi,

please consider the attached patch which changes the error handling in
`rrd_strerror' a little. A user of collectd got the following error
message:

  mmaping file '...': strerror_r failed. sorry!

It would have helped to debug his problem to know which error actually
occurred. With the attached patch, the error message will become:

  mmaping file '...': strerror_r (123) failed. sorry!

Where `123' is the error code passed to `rrd_strerror'.

I'm afraid I don't know why `strerror_r' failed in this case, the error
that was passed to it was most likely EINTR, so nothing fancy.. But I
have a suspicion..:

Please note, that error checking with
  if (strerror_r (...)) { ... }
is problematic for portability: Some systems (the GNU libc, unless given
_XOPEN_SOURCE=600, for example) export a version of `strerror_r' that
returns a pointer to the buffer it just filled, so it can be used just
like `strerror'. On such systems the block will always be executed
*except* when an error occurred.

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rrdtool-strerror_r.patch
Type: text/x-diff
Size: 716 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090212/cb785e10/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090212/cb785e10/attachment-0001.bin 


More information about the rrd-developers mailing list