[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ssh_select possible improvement? SOLVED, patch attached.
[Thread Prev] | [Thread Next]
- Subject: Re: ssh_select possible improvement? SOLVED, patch attached.
- From: Norbert Kiesel <nkiesel@xxxxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 20 Sep 2010 11:45:33 -0700
- To: libssh@xxxxxxxxxx
On Mon, 2010-09-20 at 19:27 +0200, Andreas Schneider wrote: > On Monday, September 20, 2010 18:37:57 you wrote: > > Hi Andreas, > > Hi Vic, > > > This is a really trivial fix and a tiny patch. Please review. > > thanks for your patch, I've pushed a modified version to master and v0-4. > > > -- andreas > > Just nitpicking, but the code now reads: void ssh_socket_fd_set(struct socket *s, fd_set *set, socket_t *max_fd) { if (s->fd == SSH_INVALID_SOCKET) return; FD_SET(s->fd,set); if (s->fd >= 0 && s->fd >= *max_fd && s->fd != SSH_INVALID_SOCKET) { *max_fd = s->fd + 1; } } I'd say that the "s->fd != SSH_INVALID_SOCKET" can be dropped because of the test 6 lines above and that the "s->fd >= 0" is of dubious value: it used to guard against -1 in s->fd but that got replaced with the test against SSH_INVALID_SOCKET, so a negative but valid fd (of course not possible in Linux/POSIX) should update max_fd. So I'd propose to change it to if (s->fd >= *max_fd) { *max_fd = s->fd + 1; }
ssh_select possible improvement? | Vic Lee <llyzs@xxxxxxx> |
Re: ssh_select possible improvement? | Vic Lee <llyzs@xxxxxxx> |
Re: ssh_select possible improvement? SOLVED, patch attached. | Vic Lee <llyzs@xxxxxxx> |
Re: ssh_select possible improvement? SOLVED, patch attached. | Andreas Schneider <asn@xxxxxxxxxxxx> |