[PATCH] manual: Update documentation of strerror and related functions
Florian Weimer
fweimer@redhat.com
Wed Jun 21 10:34:28 GMT 2023
* Andreas Schwab:
> On Jun 21 2023, Florian Weimer via Libc-alpha wrote:
>
>> * Florian Weimer:
>>
>>> You should not modify the string returned by @code{strerror}. Also, if
>>> +you make subsequent calls to @code{strerror} or @code{strerror_l}, or
>>> +the thread that obtained the string exits, the returned pointer will be
>>> +invalidated.
>>
>> I should point out that invalidation of the pointer on a subsequent
>> strerror or strerror_l call is likely a defect because the standard does
>> not allow this behavior.
>
> Doesn't the standard contain almost exactly the same wording?
Not in C11, it only speaks of overwriting the string during future
calls. POSIX says that it can be invalidated (I was confused before by
the CX shading, which makes this difficult to read).
If POSIX gives us permissions, this is probably good enough. It still
does not match what's documented by the man-pages project.
Thanks,
Florian
More information about the Libc-alpha
mailing list