standards/151316: lib/libc/string/strerror.c r1.9 breaks POSIX

Jilles Tjoelker jilles at
Fri Oct 15 14:48:39 UTC 2010

On Sat, Oct 09, 2010 at 04:08:50PM +0300, Kostik Belousov wrote:
> The often-used idiom is
> 	printf("Error %d %s\n", errno, strerror(errno));
> In case of errno == 0 you get
> 	Error 0: Unknown error
> or something else depending on the order of evaluation of the arguments.

But if that wrong usage is to be fully supported, strerror() should not
fail at all. This option is mentioned in POSIX.1-2008's rationale
section for strerror().

This is only sidely related to 0 being a valid input to strerror() or

Jilles Tjoelker

More information about the freebsd-standards mailing list