[PATCH] getnameinfo: Do not restore errno on error
Florian Weimer
fweimer@redhat.com
Tue Mar 8 16:46:00 GMT 2016
On 03/08/2016 04:33 PM, Zack Weinberg wrote:
> On Tue, Mar 8, 2016 at 10:20 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 03/08/2016 04:14 PM, Zack Weinberg wrote:
>>> On Tue, Mar 8, 2016 at 9:27 AM, Florian Weimer <fweimer@redhat.com> wrote:
>>>> POSIX does not require it, and this behavior is not documented
>>>> in the manual page, either.
>>>
>>> This might be OK in the actual error case, but you're stomping on
>>> errno in the *non*-error case too, which, even if allowed, should be
>>> avoided as a matter of QoI.
>>
>> We currently do not have this as a general goal for glibc functions.
>
> ... well, maybe we *should*.
I doubt it. We support interposition, so this will never be very
portable even within GNU.
>> I don't think getnameinfois special so that an exception is warranted (
>> (unlike, say, free).
>
> It's special in that it currently *does* preserve errno on success, so
> taking that out is a step in the wrong direction.
Why?
I doubt applications which rely on a preserved errno value exist, and if
they do so, they are not portable, and can even break when tested with
cwrap/nss_wrapper.
Florian
More information about the Libc-alpha
mailing list