misc/69788: The processing result of strtoul() cannot judge
whether it is an error.
sos22 at cantab.net
Fri Jul 30 02:20:32 PDT 2004
The following reply was made to PR misc/69788; it has been noted by GNATS.
From: Steven Smith <sos22 at cantab.net>
To: SAKUMA takayuki <takayuki at finet.fujitsu.com>
Cc: freebsd-gnats-submit at FreeBSD.org, sos22 at srcf.ucam.org
Subject: Re: misc/69788: The processing result of strtoul() cannot judge whether it is an error.
Date: Fri, 30 Jul 2004 10:17:58 +0100
Content-Type: text/plain; charset=us-ascii
> ul =3D strtoul("4294967296", &p, 10);
> ul =3D strtoul("4294967295", &p, 10);
> 2nd strtoul() will success, but errno =3D=3D ERANGE.
> Is it necessary to set errno as 0 before calling 2nd strtoul() ?
Yes: a succesful library call leaves errno unchanged, rather than
setting it to 0 (usually).
sos22 at cantab.net.
One day, I'm going to get an Alice-bot to answer all my email for me,
and see how long it takes people to notice.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
-----END PGP SIGNATURE-----
More information about the freebsd-bugs