Subject: Re: [PATCH v2] daemon: correctly handle soft accept() errors in service_loop

From: Junio C Hamano <[email-masked]>
Date: Fri, 27 Jun 2025 16:53:47 -0700

Carlo Marcelo Arenas Belón <[email-masked]> writes:

>> 		socklen_t sslen = sizeof(ss);
>> -		int incoming = accept(pfd[i].fd, &ss.sa, &sslen);
>> +		int incoming;
>> +		int retry = 3;
>> +
>> +		incoming = accept(pfd[i].fd, &ss.sa, &sslen);
>> 		if (incoming < 0) {
>> 			...
>
> That seems unnecessarily restrictive just to minimize churn and leaves the
> deflaration of incoming strangely sitting in between two assignments, which
> while it doesn't trigger -Wdeclaration-after-statement seems to go against
> its spirit.

Hmph, I am not Phillip, but my take on it is that incoming and retry
are fairly closely related variables in this loop, and better
grouped together?

I also find it a bit ugly to hardcode "3" here like this, but
perhaps I am overthinking about it.