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

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

Issue 671513002: [NaCk SDK] nacl_io: Don't assume ~S_IFMT are the mode bits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_umask
Patch Set: Created 6 years, 2 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 0837647e566a7c19882485d665e2271d4ab07bbe..edaa202a1f1d58f7f7811581090b449955da3d3f 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc
@@ -209,7 +209,7 @@ int KernelProxy::open_resource(const char* path) {
int KernelProxy::open(const char* path, int open_flags, mode_t mode) {
ScopedFilesystem fs;
ScopedNode node;
- mode_t mask = ~GetUmask();
+ mode_t mask = ~GetUmask() & S_MODEBITS;
Error error = AcquireFsAndNode(path, open_flags, mode & mask, &fs, &node);
if (error) {
@@ -372,7 +372,8 @@ int KernelProxy::mkdir(const char* path, mode_t mode) {
return -1;
}
- error = fs->Mkdir(rel, mode & ~GetUmask());
+ mode_t mask = ~GetUmask() & S_MODEBITS;
+ error = fs->Mkdir(rel, mode & mask);
if (error) {
errno = error;
return -1;
@@ -878,7 +879,7 @@ int KernelProxy::fchmod(int fd, mode_t mode) {
return -1;
}
- error = handle->node()->Fchmod(mode);
+ error = handle->node()->Fchmod(mode & S_MODEBITS);
if (error) {
errno = error;
return -1;
@@ -1189,7 +1190,7 @@ int KernelProxy::sigaction(int signum,
}
mode_t KernelProxy::umask(mode_t mask) {
- return SetUmask(mask);
+ return SetUmask(mask & S_MODEBITS);
}
#ifdef PROVIDES_SOCKET_API
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_object.cc ('k') | native_client_sdk/src/libraries/nacl_io/memfs/mem_fs_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698