Date: Fri, 30 Jul 2004 09:20:32 GMT From: Steven Smith <sos22@cantab.net> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/69788: The processing result of strtoul() cannot judge whether it is an error. Message-ID: <200407300920.i6U9KWoj082775@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/69788; it has been noted by GNATS.
From: Steven Smith <sos22@cantab.net>
To: SAKUMA takayuki <takayuki@finet.fujitsu.com>
Cc: freebsd-gnats-submit@FreeBSD.org, sos22@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
--9jxsPFA5p3P2qPhR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
> ul =3D strtoul("4294967296", &p, 10);
> ul =3D strtoul("4294967295", &p, 10);
>=20
> 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).
Steven Smith,
sos22@cantab.net.
--=20
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.
--9jxsPFA5p3P2qPhR
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQFBChJGO4S8/gLNrjcRAodQAJ951qp8yxY5B6y8Fk6GFvykvbfECwCgmd67
ovQTHPfFdMOHK43A+lOieY0=
=2ciO
-----END PGP SIGNATURE-----
--9jxsPFA5p3P2qPhR--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407300920.i6U9KWoj082775>
