Re: [PATCH] Re: errcode hides Comm::ListenStateData::errcode.

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 04 Aug 2010 03:22:49 +0000

On Tue, 03 Aug 2010 10:56:37 -0600, Alex Rousskov
<rousskov_at_measurement-factory.com> wrote:
> On 08/03/2010 02:33 AM, Amos Jeffries wrote:
>
>> + errcode = errno = 0; // reset errno and local copy.
>> if ((sock = accept(fd, gai->ai_addr, &gai->ai_addrlen)) < 0) {
>>
>> + errcode = errno; // store last accept errno locally.
>
>
> I would not recommend resetting the system errno before the accept()
> call. It might not be a writeable variable and resetting it is not
> really needed. POSIX guarantees that errno will be [re]set if accept()
> fails.

Okay. Will do. Thats one-pico cycle faster :)

>
>>> * The errcode member documentation ("errno code if any happened so
>>> far") is inconsistent with the code because some errors are
>>> ignored.
>>>
>>
>> Fixed.
>
> The patch does not modify errcode member documentation, AFAICT. I
> suggest something like "errno from the last listen()/accept() failure or

> zero".
>
> * It still feels wrong that listen() failures are ignored. If ignoring
> is the right thing to do, perhaps add a comment to explain why it is OK
> to ignore them?
>

Will do.
I don't know of any reason for or against and similarly have the feeling
it may be useful to somebody one day.

Amos
Received on Wed Aug 04 2010 - 03:22:54 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 04 2010 - 12:00:03 MDT