| 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..290b5f8880c67d3c07bc87141b118c4f4fdde16f 100644
|
| --- a/native_client_sdk/src/libraries/nacl_io/mount_mem.cc
|
| +++ b/native_client_sdk/src/libraries/nacl_io/mount_mem.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include <errno.h>
|
| #include <fcntl.h>
|
| +#include <unistd.h>
|
| +
|
| #include <string>
|
|
|
| #include "nacl_io/mount.h"
|
| @@ -76,6 +78,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))) {
|
| + return EACCES;
|
| + }
|
| +
|
| + return 0;
|
| +}
|
| +
|
| Error MountMem::Open(const Path& path, int mode, MountNode** out_node) {
|
| AutoLock lock(&lock_);
|
| MountNode* node = NULL;
|
|
|