[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ssh_select possible improvement?


On Tue, 2010-09-21 at 00:20 +0800, Vic Lee wrote:
> Hi Andreas,
> 
> I am able to identity this is the exact commit that introduce the
> ssh_select() bug:
> 
> http://git.libssh.org/projects/libssh/libssh.git/commit/?h=v0-4&id=22d975a24b69040b28396545e046d2334dd4c386

The only part of the patches that looks fishy is the last one:

FD_SET(s->fd,set);
- if (s->fd >= *fd_max) {
- *fd_max = s->fd + 1;
+ if (s->fd >= 0 && s->fd != SSH_INVALID_SOCKET) {
+ *max_fd = s->fd + 1;
}
}

Unless I'm missing something, in non-error-cases *max_fd is now always
set to s->fd + 1 whereas this was only done it it's > *max_fd.  Or more
concretely, shouldn't the last condition read:
 s->fd >= 0 && s->fd != SSH_INVALID_SOCKET && s->fd >= *max_fd

</nk>



References:
ssh_select possible improvement?Vic Lee <llyzs@xxxxxxx>
Re: ssh_select possible improvement?Andreas Schneider <asn@xxxxxxxxxxxx>
Re: ssh_select possible improvement?Vic Lee <llyzs@xxxxxxx>
Re: ssh_select possible improvement?Vic Lee <llyzs@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org