lib: abort if fd >= FD_SETSIZE and using select

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2017-05-07 04:42:07 +00:00
parent 69bc62ba90
commit 6a5fb771a9

View File

@ -786,6 +786,12 @@ funcname_thread_add_read_write (int dir, struct thread_master *m,
#if defined (HAVE_POLL)
thread = generic_thread_add(m, func, arg, fd, dir, debugargpass);
#else
if (fd >= FD_SETSIZE)
{
zlog_err ("File descriptor %d is >= FD_SETSIZE (%d). Please recompile"
"with --enable-poll=yes", fd, FD_SETSIZE);
assert (fd < FD_SETSIZE && !"fd >= FD_SETSIZE");
}
thread_fd_set *fdset = NULL;
if (dir == THREAD_READ)
fdset = &m->handler.readfd;