mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Test for overflowing platform FD_SET size.
This commit is contained in:
19
src/util.c
19
src/util.c
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user