This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Save/restore h_errno in getaddrinfo()


On Wed, Jul 13, 2016 at 1:47 AM, Andreas Schwab <schwab@suse.de> wrote:
> Stan Shebs <stanshebs@google.com> writes:
>
>> It turns out that subroutines of getaddrinfo() set h_errno to negative
>> values, and higher-level code such as gaih_inet tests it, but there is
>> nobody to reset it, so a negative value persists and then causes later
>> getaddrinfo calls to report an error even though everything works
>> fine.
>
> Who is looking at h_errno when there is no error?  That must be fixed.

It's this test at getaddrinfo.c:1047:

          if (h_errno == NETDB_INTERNAL)
            {
              result = -EAI_SYSTEM;
              goto free_and_return;
            }

which was extensively discussed back in May 2013:

https://sourceware.org/ml/libc-alpha/2013-05/msg00743.html

Given the number of failure modes that people were tearing their hair
out over in that thread, it's probably that everybody convinced
themselves that one couldn't get there without having set status to
something nonzero.  Perhaps the fix is as simple as testing status and
then h_errno?

Stan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]