OLD | NEW |
---|---|
(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 }; | |
OLD | NEW |