From cebef2bda3417f7ac4afb7d803e5fd096eb9f44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Fri, 4 Dec 2015 16:40:43 +0100 Subject: [PATCH] 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. --- repos/ports/src/noux/main.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/repos/ports/src/noux/main.cc b/repos/ports/src/noux/main.cc index 12f715cb3d..41ddccc325 100644 --- a/repos/ports/src/noux/main.cc +++ b/repos/ports/src/noux/main.cc @@ -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];