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

Unified Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc

Issue 547053002: [NaCl SDK] nacl_io: Remove Node::Access method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@http_fs_root
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
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..6d52cafcab8ec6bb08b2762607e26390432c4468 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,18 @@ int KernelProxy::fcntl(int fd, int request, va_list args) {
}
int KernelProxy::access(const char* path, int amode) {
- ScopedFilesystem fs;
- Path rel;
+ struct stat buf;
+ int rtn = stat(path, &buf);
+ if (rtn != 0)
+ return rtn;
- Error error = AcquireFsAndRelPath(path, &fs, &rel);
- 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;
}
- error = fs->Access(rel, amode);
- if (error) {
- errno = error;
- return -1;
- }
return 0;
}
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/jsfs/js_fs.cc ('k') | native_client_sdk/src/libraries/nacl_io/memfs/mem_fs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698