-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Gary V. Vaughan on 10/27/2008 11:49 PM:
> The current test code inside strerror.m4 says:
> 
> AC_LANG_PROGRAM(
>             [[#include <string.h>
>             ]],
>             [[return !*strerror (-2);]])
> 
> Which is fine for Solaris 9 and 10 which return "Unknown Error",
> but causes a SIGSEGV on older Solaris machines

This is intentional.  The gnulib module for strerror is _supposed_ to
replace the Solaris 8 strerror, because of this very bug.  Use of the
strerror module entitles you to write code that can correctly assume that
strerror never returns NULL, even on out-of-range input.

> The easy fix would be to change both instances of 'strerror(-2)'
> to 'strerror(1)' in strerror.m4, but that is still prone to the
> same failure if 1 is not a valid errno.  Maybe forcing an errno
> setting error by opening a non-existent file is more prudent?

No, that would be breaking the module's promise of always returning a
valid string.

> 
> I found this while linking against gnutls, which uses the string
> module, which then uses '#define strerror rpl_strerror' in its lgpl
> library when strerror is not found.  That, in turn, leads to an
> undefined rpl_strerror symbol in libgnutls.so.

That might be a bug - if the gnulib strerror module is not in use, then
the #define strerror rpl_strerror should not be in place.  But since it
looks like gnutls has been subsequently fixed to avoid strerror
altogether, I'm not sure if this still indicates any problems.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkG+y0ACgkQ84KuGfSFAYCK1ACfaSkOzljDOiH3nwamnXKPdl0V
cZkAoMbXi64Q9cvQckwVqmNIi5neJeHW
=ejdr
-----END PGP SIGNATURE-----


Reply via email to