Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: content/common/sandbox_mac.mm

Issue 202113004: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/sandbox_linux/sandbox_linux.cc ('k') | content/common/sandbox_mac_system_access_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_mac.mm
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
index 1ec37956b53ce3a3b1ddaca9bc3fcaafcf3459bf..94c3c3dc19dee6b629e3e16a68f2e43690d048a8 100644
--- a/content/common/sandbox_mac.mm
+++ b/content/common/sandbox_mac.mm
@@ -17,6 +17,7 @@ extern "C" {
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/file_util.h"
+#include "base/files/scoped_file.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
@@ -607,16 +608,15 @@ bool Sandbox::SandboxIsCurrentlyActive() {
// static
base::FilePath Sandbox::GetCanonicalSandboxPath(const base::FilePath& path) {
- int fd = HANDLE_EINTR(open(path.value().c_str(), O_RDONLY));
- if (fd < 0) {
+ base::ScopedFD fd(HANDLE_EINTR(open(path.value().c_str(), O_RDONLY)));
+ if (!fd.is_valid()) {
DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: "
<< path.value();
return path;
}
- file_util::ScopedFD file_closer(&fd);
base::FilePath::CharType canonical_path[MAXPATHLEN];
- if (HANDLE_EINTR(fcntl(fd, F_GETPATH, canonical_path)) != 0) {
+ if (HANDLE_EINTR(fcntl(fd.get(), F_GETPATH, canonical_path)) != 0) {
DPLOG(FATAL) << "GetCanonicalSandboxPath() failed for: "
<< path.value();
return path;
« no previous file with comments | « content/common/sandbox_linux/sandbox_linux.cc ('k') | content/common/sandbox_mac_system_access_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698