(loop): check that the socket fd is not too large to select on

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9111 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-10-08 18:37:08 +00:00
parent 8c87a006a4
commit 21c29c4974

View File

@@ -738,8 +738,9 @@ loop(void)
int min_free = -1;
int max_fd = 0;
int i;
FD_ZERO(&fds);
for(i = 0; i < ndescr; i++){
for(i = 0; i < ndescr; i++) {
if(d[i].s >= 0){
if(d[i].type == SOCK_STREAM &&
d[i].timeout && d[i].timeout < time(NULL)) {
@@ -750,8 +751,10 @@ loop(void)
}
if(max_fd < d[i].s)
max_fd = d[i].s;
if (max_fd >= FD_SETSIZE)
krb5_errx(context, 1, "fd too large");
FD_SET(d[i].s, &fds);
}else if(min_free < 0 || i < min_free)
} else if(min_free < 0 || i < min_free)
min_free = i;
}
if(min_free == -1){