svn commit: samba r3817 - in branches/SAMBA_3_0/source/smbd: .

jra at samba.org jra at samba.org
Wed Nov 17 19:52:26 GMT 2004


Author: jra
Date: 2004-11-17 19:52:26 +0000 (Wed, 17 Nov 2004)
New Revision: 3817

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3817

Log:
Fix from Lars M?\195?\188ller <lmuelle at suse.de> for bug #2050, calculate
max_fd for select correctly.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/server.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/server.c	2004-11-17 18:56:48 UTC (rev 3816)
+++ branches/SAMBA_3_0/source/smbd/server.c	2004-11-17 19:52:26 UTC (rev 3817)
@@ -186,6 +186,7 @@
 	int fd_listenset[FD_SETSIZE];
 	fd_set listen_set;
 	int s;
+	int max_fd = 0;
 	int i;
 	char *ports;
 
@@ -241,11 +242,16 @@
 
 			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 @@
 		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) {



More information about the samba-cvs mailing list