From owner-svn-src-all@FreeBSD.ORG Wed Aug 21 19:03:16 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 15078DEF; Wed, 21 Aug 2013 19:03:16 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-la0-x234.google.com (mail-la0-x234.google.com [IPv6:2a00:1450:4010:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F14512289; Wed, 21 Aug 2013 19:03:14 +0000 (UTC) Received: by mail-la0-f52.google.com with SMTP id ev20so656022lab.25 for ; Wed, 21 Aug 2013 12:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=RseY/6z+mFIyqCOt2Z5rKNCi+pYkdRkPy++rVrz8d94=; b=hvL3knPzvRGXpk/YL+I2u56OnC41K0Zy0QEeMEo/QjW2j7qbgTx637LqT7yOi0K5hP IvjRpUoKaL1z6U97RuaOetkC2sJZ+xKbbNGX+5FhkRBQnNP0PHbkCc/k4H8H3WhvwVQI WV/8XYV82F78JKkY3BbcpWEYiDWdLaw9PG92eEMXeA8Tehb44Xy/TY3bEXzMAelSM77R sqg0T3Y8EtesPpN7HRXNTEu4ow6dtV8mHjbvR/Pp/vgyWDncpmxKUzh/4eRK2PQnk2Y7 +IG+CCTPKIvxdl3jRaqb9cibQq4kLMxFqWSwiuHRedCDGWu0u0C2TYVG+jtkOdlaA699 Lh3g== X-Received: by 10.152.115.176 with SMTP id jp16mr7167829lab.17.1377111792981; Wed, 21 Aug 2013 12:03:12 -0700 (PDT) Received: from omg ([77.87.117.72]) by mx.google.com with ESMTPSA id qa1sm3677525lbb.1.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 Aug 2013 12:03:12 -0700 (PDT) Sender: Sergey Kandaurov Date: Wed, 21 Aug 2013 23:03:10 +0400 From: Sergey Kandaurov To: Andrey Chernov Subject: Re: svn commit: r254600 - head/lib/libutil Message-ID: <20130821190309.GB52908@omg> References: <201308211646.r7LGk6eV051215@svn.freebsd.org> <5214F72B.7070006@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JwB53PgKC5A7+0Ej" Content-Disposition: inline In-Reply-To: <5214F72B.7070006@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Aug 2013 19:03:16 -0000 --JwB53PgKC5A7+0Ej Content-Type: multipart/mixed; boundary="KN5l+BnMqAQyZLvT" Content-Disposition: inline --KN5l+BnMqAQyZLvT Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > number =3D strtoumax(buf, &endptr, 0); > > =20 > > + if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { > > + return (-1); > > + } >=20 > You need to reset errno before strtoumax() call (errno =3D 0), because any > of previous functions may left it as ERANGE. >=20 Thanks for pointing out. Does the patch look good? Index: expand_number.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- expand_number.c (revision 254600) +++ expand_number.c (working copy) @@ -53,6 +53,8 @@ unsigned shift; char *endptr; =20 + errno =3D 0; + number =3D strtoumax(buf, &endptr, 0); =20 if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { --KN5l+BnMqAQyZLvT Content-Type: text/x-diff; charset=koi8-r Content-Disposition: attachment; filename="expand_number.diff" Content-Transfer-Encoding: quoted-printable Index: expand_number.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- expand_number.c (revision 254600) +++ expand_number.c (working copy) @@ -53,6 +53,8 @@ unsigned shift; char *endptr; =20 + errno =3D 0; + number =3D strtoumax(buf, &endptr, 0); =20 if (number =3D=3D UINTMAX_MAX && errno =3D=3D ERANGE) { --KN5l+BnMqAQyZLvT-- --JwB53PgKC5A7+0Ej Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBAgAGBQJSFQ7tAAoJED9Ol7oQYHQZzHIIAKD7AtePf4E8EH1Km53AnZMt XPW5WxbmZleWNnLOWs+8+fd9if5zCDaa2//UlwTEO61KpeGJXIW9iGbPNAv79rWt 4zBfM1Q5lbZqaXEwNf+0+pENMTu6D5nhnPb5pEbdXm3nxT4K+ug93xy+dP11a/7A MiCXWerPz1ic3cqaDxjdoQiWfToTf8lQlhy64lEJ5D6W1oJ4r3pUdg7cYP0mUTG9 4WQIbvbP7rv8DAH4j72fIoHjrYFtYYYIsFAMucwbGEiiqsX8y8C27KWeAAw4XrPW 0V1GerfANCN4kcyHQtNa9WQd2cFqJ7LADHO5hfPbqD5YGaIu1pv9H+Uerdf8ia8= =F5Vq -----END PGP SIGNATURE----- --JwB53PgKC5A7+0Ej--