Subject: Re: tales of woe from the recent tools/compat_defs.h pullups on netbsd-1-6
To: NetBSD Toolchain Technical Discussion List <>
From: Alan Barrett <>
List: tech-toolchain
Date: 06/22/2004 09:57:41
On Mon, 21 Jun 2004, Greg A. Woods wrote:
> strtoul() can't, or at least our version doesn't, do reliable overflow
> detection when the maximum value expected is the same as ULONG_MAX

strtoul() and friends are documented to set errno = ERANGE on overflow.
I had a quick look at the implementation, and don't see any obvious
bugs.  So you should be able to do something like this:

	errno = 0;
	result = strtoul(...);
	if (result == ULONG_MAX && errno == ERANGE) {

--apb (Alan Barrett)