(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:
@@ -738,6 +738,7 @@ loop(void)
|
||||
int min_free = -1;
|
||||
int max_fd = 0;
|
||||
int i;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
for(i = 0; i < ndescr; i++) {
|
||||
if(d[i].s >= 0){
|
||||
@@ -750,6 +751,8 @@ 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)
|
||||
min_free = i;
|
||||
|
Reference in New Issue
Block a user