ports/net/quagga/files/patch-fdsetsize
Eugene Grosbein f29fab6043
net/quagga: add three bugfixes from upstream
This change imports three post-1.2.4 release changes
from the primary Git repository of Quagga Project:

1) Fix threading error that broke ripd:
1f918980c0

2) Fix memory corruption that may occur
when limit.rlim_cur is less then FD_SETSIZE:
b54de751ef

3) Prevent queue corruption when removing the last entry of queues
e21719d8fa

PR:		261205
Approved by:	pi (maintainer)
2022-01-15 16:48:03 +07:00

21 lines
784 B
Text

--- lib/thread.c.orig 2018-03-30 18:53:43.537794946 +0200
+++ lib/thread.c 2018-03-30 19:17:27.919629268 +0200
@@ -531,7 +531,8 @@ thread_master_create ()
return NULL;
}
- rv->fd_limit = (int)limit.rlim_cur;
+ rv->fd_limit = ((int)limit.rlim_cur < FD_SETSIZE ?
+ (int)limit.rlim_cur : FD_SETSIZE);
rv->read = XCALLOC (MTYPE_THREAD, sizeof (struct thread *) * rv->fd_limit);
if (rv->read == NULL)
{
@@ -1187,7 +1188,7 @@ thread_fetch (struct thread_master *m)
timer_wait = timer_wait_bg;
}
- num = fd_select (FD_SETSIZE, &readfd, &writefd, &exceptfd, timer_wait);
+ num = fd_select (m->fd_limit, &readfd, &writefd, &exceptfd, timer_wait);
/* Signals should get quick treatment */
if (num < 0)