noux: make copy of input fds in SYSCALL_SELECT

Executing the system call will change the input fds as a side-effect
because the select_in.fds and select_out.fds structure are part of a
union. Since the original select_in.fds content is needed afterwards
make a copy instead of using a reference.

Fixes #1809.
This commit is contained in:
Josef Söntgen 2015-12-04 16:40:43 +01:00 committed by Christian Helmuth
parent 8ca4f7a794
commit cebef2bda3
1 changed files with 7 additions and 2 deletions

View File

@ -395,8 +395,13 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
case SYSCALL_SELECT:
{
Sysio::Select_fds &in_fds = _sysio->select_in.fds;
size_t in_fds_total = in_fds.total_fds();
size_t in_fds_total = _sysio->select_in.fds.total_fds();
Sysio::Select_fds in_fds;
for (Genode::size_t i = 0; i < in_fds_total; i++)
in_fds.array[i] = _sysio->select_in.fds.array[i];
in_fds.num_rd = _sysio->select_in.fds.num_rd;
in_fds.num_wr = _sysio->select_in.fds.num_wr;
in_fds.num_ex = _sysio->select_in.fds.num_ex;
int _rd_array[in_fds_total];
int _wr_array[in_fds_total];