Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 07:24:20 +0300
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        Benedict Reuschling <bcr@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r214148 - head/lib/libc/stdlib
Message-ID:  <20101022042420.GA1389@a91-153-123-205.elisa-laajakaista.fi>
In-Reply-To: <201010211830.o9LIUnYA099338@svn.freebsd.org>
References:  <201010211830.o9LIUnYA099338@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101022042420.GA1389>