Subprocess: Close all unused file descriptors.
This patch extends Subprocess::ExecFlags() method with a list of
file descriptors that should be kept open on the child process and
mapped to a pipe() in the parent. The remaining file descriptors
will be closed.
Bug: 27880754
TEST=Added unittests for this functionality.
(cherry picked from commit e384bb2e403b0f0f666e89d5f6acfaec41120cc5)
Change-Id: I06fe529c58e179315e5a740d03c43c3b2d852526
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 734918d..127e5ff 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -396,7 +396,7 @@
// We expect to run just "p2p-client" and find it in the path.
child_pid_ = Subprocess::Get().ExecFlags(
- cmd, Subprocess::kSearchPath,
+ cmd, Subprocess::kSearchPath, {},
Bind(&LookupData::OnLookupDone, base::Unretained(this)));
if (!child_pid_) {