diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-17 19:02:35 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-17 19:02:35 +0000 |
commit | 42f558fdef03f1ec2261f554151d8a4d168919e4 (patch) | |
tree | a2f2403061c945c8983524036bc73550098de6b7 /chrome/utility | |
parent | cb8d22b096bf5698bcf58725d6e4d7534e235a0a (diff) | |
download | chromium_src-42f558fdef03f1ec2261f554151d8a4d168919e4.zip chromium_src-42f558fdef03f1ec2261f554151d8a4d168919e4.tar.gz chromium_src-42f558fdef03f1ec2261f554151d8a4d168919e4.tar.bz2 |
Implement ScopedFD in terms of ScopedGeneric.
Move to a new file base/files/scoped_file.h. I will also add ScopedFILE to here (currently in file_util.h) later.
I think there is a crash in the old code in content/browser/zygote_host/zygote_host_impl_linux.cc that this patch should fix. The old ScopedFD took the address of something in a vector that is being modified.
I removed SafeScopedFD from content/common/sandbox_linux/sandbox_linux.cc since base's ScopedFD not CHECKs on close failure (this is a more recent addition).
Reland of https://codereview.chromium.org/191673003/
R=agl, viettrungluu
Review URL: https://codereview.chromium.org/202113004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r-- | chrome/utility/importer/firefox_importer_unittest_utils_mac.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc index 6b21149..93961c5 100644 --- a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/files/file_path.h" +#include "base/files/scoped_file.h" #include "base/message_loop/message_loop.h" #include "base/posix/global_descriptors.h" #include "base/process/kill.h" @@ -47,13 +48,12 @@ bool LaunchNSSDecrypterChildProcess(const base::FilePath& nss_path, base::LaunchOptions options; options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value(); - int ipcfd = channel->TakeClientFileDescriptor(); - if (ipcfd == -1) + base::ScopedFD ipcfd(channel->TakeClientFileDescriptor()); + if (!ipcfd.is_valid()) return false; - file_util::ScopedFD client_file_descriptor_closer(&ipcfd); base::FileHandleMappingVector fds_to_map; - fds_to_map.push_back(std::pair<int,int>(ipcfd, + fds_to_map.push_back(std::pair<int,int>(ipcfd.get(), kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( |