Index: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
index a35e1822110b8874539578f079b5edd46414f13a..87f168b3cb1b33e09b6c128b39d06f8132a7c994 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc |
@@ -843,20 +843,20 @@ int KernelProxy::fcntl(int fd, int request, va_list args) { |
} |
int KernelProxy::access(const char* path, int amode) { |
- ScopedFilesystem fs; |
- Path rel; |
- |
- Error error = AcquireFsAndRelPath(path, &fs, &rel); |
- if (error) { |
- errno = error; |
+ struct stat buf; |
+ int rtn = stat(path, &buf); |
+ if (rtn != 0) { |
+ errno = rtn; |
binji
2014/09/08 18:48:26
stat above calls KernelProxy::stat, which already
Sam Clegg
2014/09/09 19:58:30
Done.
|
return -1; |
} |
- error = fs->Access(rel, amode); |
- if (error) { |
- errno = error; |
+ if (((amode & R_OK) && !(buf.st_mode & S_IREAD)) || |
+ ((amode & W_OK) && !(buf.st_mode & S_IWRITE)) || |
+ ((amode & X_OK) && !(buf.st_mode & S_IEXEC))) { |
+ errno = EACCES; |
return -1; |
} |
+ |
return 0; |
} |