Create subprocess file descriptors as cloexec
An interaction between cvd::Command and ProcessMonitor was causing file
descriptors to be leaked to subprocesses. Any file descriptor held open
by a live cvd::Command was given to any subprocess, and ProcessMonitor
was holding open several cvd::Commands for the lifetime of the entire
program.
This change creates subprocess-bound file descriptors with the
close-on-exec property set, and then unsets close-on-exec after forking
on the file descriptors intended for the child.
Bug: 144588164
Test: TreeHugger
Change-Id: I7545ec8edca900882f14bee64e278d89ed564542
1 file changed