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

Side by Side Diff: mojo/nacl/nonsfi/irt_resource_open.cc

Issue 1382713002: Creating a pexe content handler to translate and run pexes. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Tests Added Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <fcntl.h>
6
7 #include "base/files/file_util.h"
8 #include "mojo/nacl/nonsfi/irt_mojo_nonsfi.h"
9 #include "native_client/src/untrusted/irt/irt_dev.h"
10
11 int nacl_irt_open_resource(const char *pathname, int *newfd) {
Mark Seaborn 2015/10/20 21:32:40 This can go in an anon namespace and follow Chromi
Sean Klein 2015/10/22 21:50:00 Done.
12 char path[PATH_MAX];
13 char nonsfi_toolchain[] = "native_client/toolchain/linux_x86"
Mark Seaborn 2015/10/20 21:32:40 This can use 'const'
Sean Klein 2015/10/22 21:50:00 Not done, since changed to string (which has file
14 "/pnacl_translator/translator/x86-32-nonsfi/lib/";
15 strcpy(path, nonsfi_toolchain);
16 if (strcmp(pathname, "libpnacl_irt_shim.a"))
17 strcat(path, pathname);
Mark Seaborn 2015/10/20 21:32:40 Can you use C++ strings instead? This overruns th
Sean Klein 2015/10/22 21:50:00 Done.
18 else
19 strcat(path, "libpnacl_irt_shim_dummy.a");
20 int rv = open(path, O_RDONLY);
21 if (rv < 0)
22 return -rv;
Mark Seaborn 2015/10/20 21:32:40 Should return errno instead.
Sean Klein 2015/10/22 21:50:00 Done.
23 *newfd = rv;
24 return 0;
25 }
26
27 const struct nacl_irt_resource_open nacl_irt_resource_open = {
28 nacl_irt_open_resource,
29 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698