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

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..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;
}

Powered by Google App Engine
This is Rietveld 408576698