svn commit: r214148 - head/lib/libc/stdlib

Jaakko Heinonen jh at FreeBSD.org
Fri Oct 22 04:24:27 UTC 2010


On 2010-10-21, Benedict Reuschling wrote:
>   Document strtonum()s behavior of setting errno to 0 when no error is found.

strtonum(3) doesn't behave like this. Anyway setting errno to 0 in a
library function would violate the C99 standard.

%%%
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int
main()
{

	errno = EDOOFUS;
	if (strtonum("1", 1, 10, NULL) == 0)
		err(1, "failed");

	printf("%d\n", errno);

	return (0);
}
%%%

$ cc test.c
$ ./a.out 
88

-- 
Jaakko


More information about the svn-src-all mailing list