[distcc] errno not reset by connect(2)

Jean Delvare khali at linux-fr.org
Sat Nov 6 08:49:53 GMT 2004


Hi Daniel,

> Oh, I see now.  It's the line after Jean's patch where
> distcc checks errno:
> 
>      while ((connect(fd, sa, salen) == -1) && errno == EINTR)
>          ;
> 
>      if (errno && errno != EINPROGRESS) {
> 
> So Jean's patch is right.   It might be cleaner to avoid
> setting errno, though, and write this all as
> 
>      int failed = 0;
>      do
>          failed = connect(fd, sa, salen);
>      while (failed && errno == EINTR);
> 
>      if (failed && errno != EINPROGRESS) {
> 
> What do you think, Jean?  Sorry for not understanding your
> patch originally.

Both will fix the problem as far as I can see (although I cannot test
your variant until monday morning (CET)). Yours is slightly cleaner (do
not check errno if no error actually occured), mine is slightly more
compact (no additional variable). Both are fine with me so I would let
Martin pick the variant he prefers.

Thanks,

-- 
Jean Delvare
http://khali.linux-fr.org/


More information about the distcc mailing list