Index: components/nacl/browser/nacl_browser.cc |
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc |
index 04bc7a27675186aefdd83139109874428d005a57..b1f1236b7a29e5cc897198c77f237243b38ed283 100644 |
--- a/components/nacl/browser/nacl_browser.cc |
+++ b/components/nacl/browser/nacl_browser.cc |
@@ -119,34 +119,32 @@ const int64 kCrashesIntervalInSeconds = 120; |
namespace nacl { |
-void OpenNaClExecutableImpl(const base::FilePath& file_path, |
- base::PlatformFile* file) { |
+base::PlatformFile OpenNaClExecutableImpl(const base::FilePath& file_path) { |
// Get a file descriptor. On Windows, we need 'GENERIC_EXECUTE' in order to |
// memory map the executable. |
// IMPORTANT: This file descriptor must not have write access - that could |
// allow a NaCl inner sandbox escape. |
+ base::PlatformFile file; |
base::PlatformFileError error_code; |
- *file = base::CreatePlatformFile( |
+ file = base::CreatePlatformFile( |
file_path, |
(base::PLATFORM_FILE_OPEN | |
base::PLATFORM_FILE_READ | |
base::PLATFORM_FILE_EXECUTE), // Windows only flag. |
NULL, |
&error_code); |
- if (error_code != base::PLATFORM_FILE_OK) { |
- *file = base::kInvalidPlatformFileValue; |
- return; |
- } |
+ if (error_code != base::PLATFORM_FILE_OK) |
+ return base::kInvalidPlatformFileValue; |
+ |
// Check that the file does not reference a directory. Returning a descriptor |
// to an extension directory could allow an outer sandbox escape. openat(...) |
// could be used to traverse into the file system. |
base::PlatformFileInfo file_info; |
- if (!base::GetPlatformFileInfo(*file, &file_info) || |
- file_info.is_directory) { |
- base::ClosePlatformFile(*file); |
- *file = base::kInvalidPlatformFileValue; |
- return; |
+ if (!base::GetPlatformFileInfo(file, &file_info) || file_info.is_directory) { |
+ base::ClosePlatformFile(file); |
+ return base::kInvalidPlatformFileValue; |
} |
+ return file; |
} |
NaClBrowser::NaClBrowser() |