summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-07 23:03:08 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-07 23:03:08 +0000
commit699de0baff4a4db3db0c91236accbe30830c4b0f (patch)
tree8caab95de1a07034b91bfbd765881ff13186bd6d /base
parent10bec854183f2db82063fcecf185ff16a34ae1e5 (diff)
downloadchromium_src-699de0baff4a4db3db0c91236accbe30830c4b0f.zip
chromium_src-699de0baff4a4db3db0c91236accbe30830c4b0f.tar.gz
chromium_src-699de0baff4a4db3db0c91236accbe30830c4b0f.tar.bz2
CloseSuperfluousFiles shouldn't close the directory it's reading from
BUG=none TEST=none (found with strace while running e.g. ProcessUtilTest.FDRemapping) Review URL: http://codereview.chromium.org/115720 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process_util_posix.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index c293cbe..d5d6cb8 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -146,6 +146,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
}
return;
}
+ int dir_fd = dirfd(dir);
struct dirent *ent;
while ((ent = readdir(dir))) {
@@ -160,6 +161,8 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
continue;
if (saved_fds.find(fd) != saved_fds.end())
continue;
+ if (fd == dir_fd)
+ continue;
// When running under Valgrind, Valgrind opens several FDs for its
// own use and will complain if we try to close them. All of