strtol(3) setting of errno
Alejandro Colomar
alx@kernel.org
Thu Nov 30 12:40:16 GMT 2023
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/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-help/attachments/20231130/ab39bd8d/attachment.sig>
More information about the Libc-help
mailing list