Todd C. Miller wrote:
> On Fri, 19 Aug 2016 19:14:54 -0400, "Ted Unangst" wrote:
>
> > hmm. so I was trying to avoid the need for two different functions. I think
> > there's a mental overhead to "do this, then maybe that". this loop reads
> > very strangely to me. it's hard to mentally trace the code. it's not really
> > a
> > loop, just goto spelled with break and continue.
>
> I suppose it is better to just use connect() and connect_wait() in
> a for() loop. Whichever way you choose we should put as an example
> in connect(2).
> + for (error = connect(s, res->ai_addr, res->ai_addrlen);
> + error != 0 && errno == EINTR; error = connect_wait(s))
> + continue;
> + if (error != 0) {
This is a pretty cool style.