summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-10 17:09:45 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-10 17:09:45 +0000
commite5f8065b05b2d85b881bb5ddf038fb341f0dc6a1 (patch)
tree9602612e82d08ad5ae9b48f3b483a0a8f7fa8d1d /base
parent46f979d4c5716549777cef154423fa4fb76210d9 (diff)
downloadchromium_src-e5f8065b05b2d85b881bb5ddf038fb341f0dc6a1.zip
chromium_src-e5f8065b05b2d85b881bb5ddf038fb341f0dc6a1.tar.gz
chromium_src-e5f8065b05b2d85b881bb5ddf038fb341f0dc6a1.tar.bz2
Fix file descriptor leak in base_unittests ProcessUtilTest.LaunchApp. The
TestLaunchApp helper function should close base_unittests' end of the pipe. BUG=none TEST=base_unittests --gtest_filter=ProcessUtilTest.LaunchApp Review URL: http://codereview.chromium.org/6128004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70901 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process_util_unittest.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 672e396..1b7368a 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -485,12 +485,15 @@ std::string TestLaunchApp(const base::environment_vector& env_changes) {
fds_to_remap.push_back(std::make_pair(fds[1], 1));
EXPECT_TRUE(base::LaunchApp(args, env_changes, fds_to_remap,
- true /* wait for exit */, &handle));
- PCHECK(close(fds[1]) == 0);
+ true /* wait for exit */, &handle));
+ PCHECK(HANDLE_EINTR(close(fds[1])) == 0);
char buf[512];
const ssize_t n = HANDLE_EINTR(read(fds[0], buf, sizeof(buf)));
PCHECK(n > 0);
+
+ PCHECK(HANDLE_EINTR(close(fds[0])) == 0);
+
return std::string(buf, n);
}