From: Alejandro Colomar <alx@kernel.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: GNU C Library <libc-help@sourceware.org>,
Linux man-pages <linux-man@vger.kernel.org>,
Iker Pedrosa <ipedrosa@redhat.com>,
shadow <~hallyn/shadow@lists.sr.ht>,
Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: strtol(3) setting of errno
Date: Thu, 30 Nov 2023 13:40:16 +0100 [thread overview]
Message-ID: <ZWiCsBkRpOLEc1Y3@debian> (raw)
In-Reply-To: <87cyvrv4bl.fsf@oldenburg.str.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 826 bytes --]
Hi Florian,
On Thu, Nov 30, 2023 at 01:00:30PM +0100, Florian Weimer wrote:
> * Alejandro Colomar:
>
> > 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?
>
> 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
>
> Thanks,
> Florian
>
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-11-30 12:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 9:22 Alejandro Colomar
2023-11-30 12:00 ` Florian Weimer
2023-11-30 12:40 ` Alejandro Colomar [this message]
2023-11-30 22:13 ` Jakub Wilk
2023-11-30 22:45 ` Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWiCsBkRpOLEc1Y3@debian \
--to=alx@kernel.org \
--cc=fweimer@redhat.com \
--cc=ipedrosa@redhat.com \
--cc=libc-help@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=~hallyn/shadow@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).