gsubprocesslauncher: Don’t close target FDs in close() method
This is a regression introduced in commit 67a589e5. Previously, the
source/target FD pairs were stored in needdup_fd_assignments
, in
consecutive entries, so source FDs had even indices and target FDs had
odd indices.
I didn’t notice that the array index was being incremented by 2 when closing FDs, when porting from the old code. So previously the code was only closing the source FDs; after the port, it was closing source and target FDs.
That’s incorrect, as the target FDs are just integers in the parent
process. It’s only in the child process where they are actually FDs —
and g_subprocess_launcher_close()
is never called in the child
process.
This resulted in some strange misbehaviours in any process which used
g_subprocess_launcher_take_fd()
with target FDs which could have
possibly aliased with other FDs in the parent process (and which weren’t
equal to their mapped source FDs).
Thanks to Olivier Fourdan for the detailed bug report.
Signed-off-by: Philip Withnall pwithnall@endlessos.org
Fixes: #2332 (closed)