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

Unified Diff: src/trusted/service_runtime/sel_main.c

Issue 12226119: Factor out duplicated GioMemoryFileSnapshotCtor() + NaClAppLoadFile() calls (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 10 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 | « src/trusted/service_runtime/mmap_test.c ('k') | src/trusted/service_runtime/service_runtime.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/sel_main.c
diff --git a/src/trusted/service_runtime/sel_main.c b/src/trusted/service_runtime/sel_main.c
index f3d7d0f32dfe769561c4a814431bf8dce53236e2..fd23eb9aa0f3e47519c014db466600e7495b2347 100644
--- a/src/trusted/service_runtime/sel_main.c
+++ b/src/trusted/service_runtime/sel_main.c
@@ -36,6 +36,7 @@
#include "native_client/src/trusted/perf_counter/nacl_perf_counter.h"
#include "native_client/src/trusted/service_runtime/env_cleanser.h"
#include "native_client/src/trusted/service_runtime/include/sys/fcntl.h"
+#include "native_client/src/trusted/service_runtime/load_file.h"
#include "native_client/src/trusted/service_runtime/nacl_app.h"
#include "native_client/src/trusted/service_runtime/nacl_all_modules.h"
#include "native_client/src/trusted/service_runtime/nacl_bootstrap_channel_error_reporter.h"
@@ -552,20 +553,9 @@ int NaClSelLdrMain(int argc, char **argv) {
NaClAppInitialDescriptorHookup(nap);
if (!rpc_supplies_nexe) {
- struct GioMemoryFileSnapshot main_file;
-
- NaClFileNameForValgrind(nacl_file);
- if (0 == GioMemoryFileSnapshotCtor(&main_file, nacl_file)) {
- perror("sel_main");
- fprintf(stderr, "Cannot open \"%s\".\n", nacl_file);
- exit(1);
- }
- NaClPerfCounterMark(&time_all_main, "SnapshotNaclFile");
- NaClPerfCounterIntervalLast(&time_all_main);
-
if (LOAD_OK == errcode) {
NaClLog(2, "Loading nacl file %s (non-RPC)\n", nacl_file);
- errcode = NaClAppLoadFile((struct Gio *) &main_file, nap);
+ errcode = NaClAppLoadFileFromFilename(nap, nacl_file);
if (LOAD_OK != errcode) {
fprintf(stderr, "Error while loading \"%s\": %s\n",
nacl_file,
@@ -585,12 +575,6 @@ int NaClSelLdrMain(int argc, char **argv) {
NaClXMutexUnlock(&nap->mu);
}
- if (-1 == (*((struct Gio *) &main_file)->vtbl->Close)((struct Gio *)
- &main_file)) {
- fprintf(stderr, "Error while closing \"%s\".\n", nacl_file);
- }
- (*((struct Gio *) &main_file)->vtbl->Dtor)((struct Gio *) &main_file);
-
if (fuzzing_quit_after_load) {
exit(0);
}
« no previous file with comments | « src/trusted/service_runtime/mmap_test.c ('k') | src/trusted/service_runtime/service_runtime.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698