diff options
author | Jeremy Allison <jra@samba.org> | 2004-11-17 19:52:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:19 -0500 |
commit | d12a7fdee2d7267ea9b9d7b5b3359015258ace4e (patch) | |
tree | e2d847e9e19d264a9403e4fdb71a887054dc56f1 /source3/smbd | |
parent | 7eaba1f52881b8595ca2cfe750cf5d6c62de4cda (diff) | |
download | samba-d12a7fdee2d7267ea9b9d7b5b3359015258ace4e.tar.gz samba-d12a7fdee2d7267ea9b9d7b5b3359015258ace4e.tar.bz2 samba-d12a7fdee2d7267ea9b9d7b5b3359015258ace4e.zip |
r3817: Fix from Lars Müller <lmuelle@suse.de> for bug #2050, calculate
max_fd for select correctly.
Jeremy.
(This used to be commit eb0b1f757d814e01980cd9c5fc4918791ce1e54d)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/server.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index e40d1f8bc7..5f2713bb83 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -186,6 +186,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_ int fd_listenset[FD_SETSIZE]; fd_set listen_set; int s; + int max_fd = 0; int i; char *ports; @@ -241,11 +242,16 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_ for (ptr=ports; next_token(&ptr, tok, NULL, sizeof(tok)); ) { unsigned port = atoi(tok); - if (port == 0) continue; + if (port == 0) { + continue; + } s = fd_listenset[num_sockets] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True); if(s == -1) return False; + if (max_fd < s) + max_fd = s; + /* ready to listen */ set_socket_options(s,"SO_KEEPALIVE"); set_socket_options(s,user_socket_options); @@ -335,7 +341,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_ memcpy((char *)&lfds, (char *)&listen_set, sizeof(listen_set)); - num = sys_select(FD_SETSIZE,&lfds,NULL,NULL,NULL); + num = sys_select(max_fd+1,&lfds,NULL,NULL,NULL); if (num == -1 && errno == EINTR) { if (got_sig_term) { |