summaryrefslogtreecommitdiffstats
path: root/chrome/browser/process_singleton_mac_unittest.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 19:36:50 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-14 19:36:50 +0000
commitc0e895e2961bd05570b0d7660016914601bf8c7d (patch)
tree3104b59d5f4d22ad60a35a3bcefdb7caff27d3c0 /chrome/browser/process_singleton_mac_unittest.cc
parent5fcc99e7cf20aa9d0c44e2fdaef207d9e45f907a (diff)
downloadchromium_src-c0e895e2961bd05570b0d7660016914601bf8c7d.zip
chromium_src-c0e895e2961bd05570b0d7660016914601bf8c7d.tar.gz
chromium_src-c0e895e2961bd05570b0d7660016914601bf8c7d.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). BUG= R=agl@chromium.org, viettrungluu@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=257001 Review URL: https://codereview.chromium.org/191673003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_singleton_mac_unittest.cc')
-rw-r--r--chrome/browser/process_singleton_mac_unittest.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/chrome/browser/process_singleton_mac_unittest.cc b/chrome/browser/process_singleton_mac_unittest.cc
index 4246c27..b6a5b7b 100644
--- a/chrome/browser/process_singleton_mac_unittest.cc
+++ b/chrome/browser/process_singleton_mac_unittest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/process_singleton.h"
#include "base/file_util.h"
+#include "base/files/scoped_file.h"
#include "base/path_service.h"
#include "base/posix/eintr_wrapper.h"
#include "chrome/common/chrome_constants.h"
@@ -39,15 +40,13 @@ class ProcessSingletonMacTest : public PlatformTest {
// Return |true| if the file exists and is locked. Forces a failure
// in the containing test in case of error condition.
bool IsLocked() {
- int fd = HANDLE_EINTR(open(lock_path_.value().c_str(), O_RDONLY));
- if (fd == -1) {
+ base::ScopedFD fd(HANDLE_EINTR(open(lock_path_.value().c_str(), O_RDONLY)));
+ if (!fd.is_valid()) {
EXPECT_EQ(ENOENT, errno) << "Unexpected error opening lockfile.";
return false;
}
- file_util::ScopedFD auto_close(&fd);
-
- int rc = HANDLE_EINTR(flock(fd, LOCK_EX|LOCK_NB));
+ int rc = HANDLE_EINTR(flock(fd.get(), LOCK_EX|LOCK_NB));
// Got the lock, so it wasn't already locked. Close releases.
if (rc != -1)