This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] getaddrinfo: Use &errno has the errno pointer
- From: Florian Weimer <fweimer at redhat dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 31 Aug 2017 20:39:02 +0200
- Subject: Re: [PATCH] getaddrinfo: Use &errno has the errno pointer
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 283B77E44D
- References: <email@example.com>
On 08/31/2017 07:49 PM, DJ Delorie wrote:
> My only real concern about this patch set is...
> firstname.lastname@example.org (Florian Weimer) writes:
>> status = DL_CALL_FCT (fct, (name, _family, &th, \
>> tmpbuf->data, tmpbuf->length, \
>> - &rc, &herrno, NULL, &localcanon)); \
>> - if (rc != ERANGE || herrno != NETDB_INTERNAL) \
>> + &errno, &herrno, NULL, &localcanon)); \
>> + if (errno != ERANGE || herrno != NETDB_INTERNAL) \
> Are we sure that errno will not *already* be ERANGE when the function is
> called? IIRC it's the app's responsibility to zero it out after it's
> dealt with the errors, so there's a chance it will happen to have the
> "right" error already, and you'll test a false positive here.
> The original code avoided this by setting rc to 0 before calling.
It does not. See bug 21915. This is fixed by a later patch is the series:
Does this answer your question?