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
tree: cd58d3000771b96e507af3d47a18f11bcc394836
  1. common/
  2. guest/
  3. host/
  4. tests/
  5. tools/
  6. Android.bp
  7. Android.mk
  8. OWNERS
  9. TEST_MAPPING