Test for overflowing platform FD_SET size.

This commit is contained in:
Simon Kelley committed 2015-07-08 22:38:13 +01:00
1 parent 60176c7bf4
commit f6d6956261
5 files changed
+41 -69

No files matched your search

+16 -3
View File
@@ -570,10 +570,23 @@ char *print_mac(char *buff, unsigned char *mac, int len)
return buff;
}
void bump_maxfd(int fd, int *max)
void bump_maxfd(fd_set *set, int fd, int *max)
{
if (fd > *max)
*max = fd;
#ifdef FD_SETSIZE
if (fd >= FD_SETSIZE)
{
static int logged = 0;
if (!logged)
my_syslog(LOG_ERR, _("File descriptor overflows FS_SET"));
logged = 1;
}
else
#endif
{
FD_SET(fd, set);
if (fd > *max)
*max = fd;
}
}
/* rc is return from sendto and friends.