In POSIX:2008, strerror may fail for an invalid argument. Likewise in POSIX:2001 and SUSv2 from 1997.
"Because no return value is reserved to indicate an error, an application wishing to check for error situations should set errno to 0, then call strerror(), then check errno." Hardly any program does this checking. Therefore it's good that gnulib's strerror module guarantees to work around against this pitfall. I'm adding a comment about it: 2010-11-09 Bruno Haible <br...@clisp.org> * doc/posix-functions/strerror.texi: Add a comment. --- doc/posix-functions/strerror.texi.orig Tue Nov 9 21:56:38 2010 +++ doc/posix-functions/strerror.texi Tue Nov 9 21:56:17 2010 @@ -16,6 +16,8 @@ This function fails to return a string for out-of-range integers on some platforms: Solaris 8. +(This is not a POSIX violation, but can still cause bugs because most programs +call @code{strerror} without setting and testing @code{errno}.) @end itemize Portability problems not fixed by Gnulib: