From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by sourceware.org (Postfix) with ESMTPS id 109BB3858D32 for ; Thu, 30 Nov 2023 12:40:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 109BB3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 109BB3858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=145.40.73.55 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701348026; cv=none; b=jGzG45+NbuTJseCYnZwzxE6XrI1fvB1D7d1gh3hxWwkzuFAg18oUOuiysD45FgjW24Dk/5VSE3zOyojzHEttg8ahsqPT/I5/DcuRlJlHXd4xM6i7Yx5tXLTxVyHvFsCBCS/AQ3++1hm9qGk2dFmy8gHKuldvmTAV7rSfdRqd7IE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701348026; c=relaxed/simple; bh=vjAxLHE4Qpr3Pcd3/ne9WLGhR6GUlJgmrfQ4e4sF1r8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=TarJ4FdB9SUzyeS7SQUQiA4D3ryAg36CSsh18kHlmLnkCTvrGSQCzPTo7/nysDDHBjS1SyYWZ3eqrj8IBFopvFNTgMhYA5oAlhU7kh7NzeODq93feUnlDSNb9FmRumhyE+p43MM5ZcbrOQBCxw4sJ4evr8b6LGtSQVJPpJkrCfQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 76235CE1FE0; Thu, 30 Nov 2023 12:40:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 211F9C433C8; Thu, 30 Nov 2023 12:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701348020; bh=vjAxLHE4Qpr3Pcd3/ne9WLGhR6GUlJgmrfQ4e4sF1r8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O1qgjSoEUosxGtpAYigTuSMNzz5NYc/Pjn8fTTC6IiD54md+prxPH+d9UWXg7OWz+ E3pAr5MSRa5/07194PS9tjQRIUPIE0ppJthTrSlTp2ShygWyEtKSk4ibsAp+gFRH6y FzSbZcJiE5wHkb2d4CgP177As4fcKUhXttv787OVu+EPtbZZNSkhrc0TZmchH6ToD+ GPHFLB0DeFiCeuByX959CDcKH3erR/mDLiDi+ivEKNkm+bnE6SbH25x1YKsolFracr kmgN888D6URqMbLrCGX2liM6rXs5Xyb7S4NXF3/WUaFQXKpCISwVZ6g+9rBHjZ/350 i/CKXxlHgMOSA== Date: Thu, 30 Nov 2023 13:40:16 +0100 From: Alejandro Colomar To: Florian Weimer Cc: GNU C Library , Linux man-pages , Iker Pedrosa , shadow <~hallyn/shadow@lists.sr.ht>, Michael Kerrisk Subject: Re: strtol(3) setting of errno Message-ID: References: <87cyvrv4bl.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hAMQJ/rSOKFu9kb5" Content-Disposition: inline In-Reply-To: <87cyvrv4bl.fsf@oldenburg.str.redhat.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --hAMQJ/rSOKFu9kb5 Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Thu, 30 Nov 2023 13:40:16 +0100 From: Alejandro Colomar To: Florian Weimer Cc: GNU C Library , Linux man-pages , Iker Pedrosa , shadow <~hallyn/shadow@lists.sr.ht>, Michael Kerrisk Subject: Re: strtol(3) setting of errno Hi Florian, On Thu, Nov 30, 2023 at 01:00:30PM +0100, Florian Weimer wrote: > * Alejandro Colomar: >=20 > > Now I realize that commit was probably wrong, and one needs to check > > both errno and the return value to determine that the call failed. Can > > you please confirm what the correct specification of strtol(3) is? >=20 > The most detailed specification we have is the one that is in POSIX. Since POSIX doesn't specify, I assume it allows setting errno on success, as with any other libc function. That includes setting errno on a successful call that returns 0. Which means that the errno check must check for the specific errno values that actually mean an error of this function. I'll update the page. Thanks, Alex >=20 > Thanks, > Florian >=20 --=20 --hAMQJ/rSOKFu9kb5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmVogrAACgkQnowa+77/ 2zKjug//ar8MJ1cKKKUMV3ByHSHaafrmJln6ieGBmWn+M16VV41mvy+rQkQa+pXI gboxsH+E5Br/mARFPdMLIJZSY7Ised2GfVXr6rTcRAv541e2PV3rjTVpfXBoCpME TLy+ZGyvBemVxJALFPNfWtZRl9JQ7GL6kjY3RhxoAAOl01cRGhwMUaysSrDPcjTL Gu2OLA7WbDu6EiWzLkkG4aKRCfIehRX2aJfvdLG99Y2bTIWvqtqd+rjNzafJH63T hF/TgsAwuNQVH4a9Hy1RQ/g6hJYBoPelw0v7sEFTHV6IwUnVnGRb5N+w/WCFcjdl KyaASSo3ZLWxHQVICU78yguhLbaOJGDc+Gh5d4CNqaPLyyMurpKFZ5jxsk6PIjak xjnmCe69UZqvkdg43lM7Asqodsubdp6iHbJcoYtwRV8BsUJqqvRDXXP2Uk0YXNgB I6KUzTS/gmqSi4KmGdj7EAEWSOlYHlBCPVG+dwECuf7bEl8fjRNSCjSuEwGeEFXZ 1l/CrRQ0ynIP8cstq8AAUbffA3UTdDFe1haTSgYvN1HBjQBI2ICFQjah2MaQakq7 YRC6TEaAHTIJ8OMoHijKMNAJvYushKYGFD3OEt1YDjQup8ZBwExgKwvIbl/p5pbd F0WGI9TvC0Z8SgAN+BquL3+0PQ06MZgRm5sXeAwNmuR67bKfr48= =WC8n -----END PGP SIGNATURE----- --hAMQJ/rSOKFu9kb5--