mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 05:35:38 +08:00
ipsec-tools: Fix copying fd_set prior to select
The racoon session code copies an fd_set from one variable into another prior to calling select. That works well for simple structures. In libbsd we have to allocate fd_sets instead of using fixed structures to avoid a problem with file numbers bigger than FD_SETSIZE. The simple assignment didn't work in that case. This patch makes sure that a memcpy is used instead. Update #4913
This commit is contained in:
parent
16be3a7c7d
commit
dfb2144641
@ -215,6 +215,8 @@ session(void)
|
|||||||
#ifndef __rtems__
|
#ifndef __rtems__
|
||||||
FD_ZERO(&preset_mask);
|
FD_ZERO(&preset_mask);
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
|
size_t allocated_mask_size = sizeof(fd_set) *
|
||||||
|
howmany(rtems_libio_number_iops, sizeof(fd_set) * 8);
|
||||||
allocated_preset_mask = calloc(sizeof(fd_set),
|
allocated_preset_mask = calloc(sizeof(fd_set),
|
||||||
howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));
|
howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));
|
||||||
if (allocated_preset_mask == NULL)
|
if (allocated_preset_mask == NULL)
|
||||||
@ -352,7 +354,12 @@ session(void)
|
|||||||
|
|
||||||
/* schedular can change select() mask, so we reset
|
/* schedular can change select() mask, so we reset
|
||||||
* the working copy here */
|
* the working copy here */
|
||||||
|
#ifndef __rtems__
|
||||||
active_mask = preset_mask;
|
active_mask = preset_mask;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
memcpy(allocated_active_mask, allocated_preset_mask,
|
||||||
|
allocated_mask_size);
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
error = select(nfds + 1, &active_mask, NULL, NULL, timeout);
|
error = select(nfds + 1, &active_mask, NULL, NULL, timeout);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user