Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/mount_mem.cc |
| diff --git a/native_client_sdk/src/libraries/nacl_io/mount_mem.cc b/native_client_sdk/src/libraries/nacl_io/mount_mem.cc |
| index 356600b4ec07b9bc6f2f030266ae2ca1a5514b0f..0bfab24810ea7ff4c70b629b9fe3d21b3a166233 100644 |
| --- a/native_client_sdk/src/libraries/nacl_io/mount_mem.cc |
| +++ b/native_client_sdk/src/libraries/nacl_io/mount_mem.cc |
| @@ -7,6 +7,7 @@ |
| #include <errno.h> |
| #include <fcntl.h> |
| #include <string> |
| +#include <unistd.h> |
| #include "nacl_io/mount.h" |
| #include "nacl_io/mount_node.h" |
| @@ -76,6 +77,24 @@ Error MountMem::FindNode(const Path& path, int type, MountNode** out_node) { |
| return 0; |
| } |
| +Error MountMem::Access(const Path& path, int a_mode) { |
| + AutoLock lock(&lock_); |
| + MountNode* node = NULL; |
| + Error error = FindNode(path, 0, &node); |
| + |
| + if (error) |
| + return error; |
| + |
| + int obj_mode = node->GetMode(); |
| + if (((a_mode & R_OK) && !(obj_mode & S_IREAD)) || |
| + ((a_mode & W_OK) && !(obj_mode & S_IWRITE)) || |
| + ((a_mode & X_OK) && !(obj_mode & S_IEXEC))) { |
|
binji
2013/06/19 16:46:28
no exec
Matt Giuca
2013/06/20 01:43:14
See comment on mount_html5fs.
Also note that rega
binji
2013/06/20 16:07:21
OK
|
| + return EACCES; |
| + } |
| + |
| + return 0; |
| +} |
| + |
| Error MountMem::Open(const Path& path, int mode, MountNode** out_node) { |
| AutoLock lock(&lock_); |
| MountNode* node = NULL; |