Index: ppapi/native_client/src/trusted/plugin/plugin.cc |
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc |
index d0ac72dfe1cb6981f628ee83ab601b07100b705d..e3b286cdfcc986b8d1dd2ef427d8bd7c0d5607c2 100644 |
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc |
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc |
@@ -26,6 +26,7 @@ |
#include "native_client/src/include/portability_string.h" |
#include "native_client/src/shared/platform/nacl_check.h" |
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h" |
+#include "native_client/src/trusted/desc_cacheability/desc_cacheability.h" |
#include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h" |
#include "native_client/src/trusted/service_runtime/nacl_error_code.h" |
@@ -604,9 +605,24 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) { |
if (nexe_bytes_read == -1) |
return; |
+ // Handing desc ownership to the wrapper. |
+ // However, we still need the tokens so keep that in the tmp_info. |
+ tmp_info = info.Release(); |
nacl::scoped_ptr<nacl::DescWrapper> |
- wrapper(wrapper_factory()->MakeFileDesc(info.Release().desc, O_RDONLY)); |
- NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n"); |
+ wrapper(wrapper_factory()->MakeFileDesc(tmp_info.desc, O_RDONLY)); |
+ tmp_info.desc = -1; |
+ if (tmp_info.file_token.lo != 0 && tmp_info.file_token.hi != 0) { |
+ if (!NaClDescSetFileToken(wrapper->desc(), &tmp_info.file_token)) { |
+ PLUGIN_PRINTF(( |
+ "NexeFileDidOpen: NaClDescSetFileToken failed\n")); |
+ } else { |
+ PLUGIN_PRINTF(( |
+ "NexeFileDidOpen: NaClDescSetFileToken success\n")); |
+ } |
+ } else { |
+ PLUGIN_PRINTF(("NexeFileDidOpen: No file tokens for NaCl main nexe\n")); |
+ } |
+ PLUGIN_PRINTF(("NexeFileDidOpen: invoking LoadNaClModule\n")); |
LoadNaClModule( |
wrapper.release(), |
uses_nonsfi_mode_, |