[distcc] errno not reset by connect(2)

Daniel Kegel dank at kegel.com
Fri Nov 5 21:01:56 GMT 2004


Jean Delvare wrote:
> I found that I need the following patch for distcc (2.18.1) to work on
> my SunOS 5.8 workstation at work. Looks like on this system, connect(2)
> won't reset errno to 0 when successful. I guess this is a broken
> behavior to have, but the workaround in the distcc code isn't too
> intrusive and obviously safe for all systems, so maybe we can get it in?
> 
> --- distcc-2.18.1/src/clinet.c.orig	Fri Nov  5 14:11:10 2004
> +++ distcc-2.18.1/src/clinet.c	Fri Nov  5 11:53:04 2004
> @@ -100,6 +100,7 @@
>      dcc_set_nonblocking(fd);
>  
>      /* start the nonblocking connect... */
> +    errno = 0;
>      while ((connect(fd, sa, salen) == -1) && errno == EINTR)

SuSv3 says
     "Upon successful completion, connect() shall return 0;
       otherwise, -1 shall be returned and errno set to indicate the error."
and "No function in this volume of IEEE Std 1003.1-2001 shall set errno to 0."

Thus your change should have no effect on any POSIX-compliant system.
Can you dig into the problem a bit more, and see what's
really going on?
- Dan



More information about the distcc mailing list