[PATCH] connect() timeout

Markus Friedl markus at openbsd.org
Fri Apr 5 00:09:58 EST 2002


nice, could you please add this to http://bugzilla.mindrot.org/

On Wed, Apr 03, 2002 at 11:58:25PM +0200, Jean-Charles Longuet wrote:
> +	fd_set fds;
> +
> +        int optval = 0;

^^ pipe thought unexpand.

> +	struct timeval tv;
> +
> +
^^ check style(9)

> +	if (timeout <= 0)
> +		return(connect(sockfd, serv_addr, addrlen));
> +
> +	if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
> +	{

^^ check style(9)

> +	rc = connect(sockfd, serv_addr, addrlen);
> +	if (rc == 0)
> +		return 0;
> +	if (errno != EINPROGRESS)
> +		return -1;
> +
> +	FD_ZERO(&fds);
> +	FD_SET(sockfd, &fds);
^^^ the fdset might overflow, please allocate fds dynamically
like the rest of ssh does.



More information about the openssh-unix-dev mailing list