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

Unified Diff: native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.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/fusefs/fuse_fs.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
index d072392631ee033118bab4ace1c85c32f2b18ffc..100fb113b6bfecaef3b2b0dca3f2d59d55b64dfa 100644
--- a/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/fusefs/fuse_fs.cc
@@ -90,7 +90,7 @@ Error FuseFs::OpenWithMode(const Path& path, int open_flags, mode_t mode,
if (result < 0)
return -result;
- if ((statbuf.st_mode & S_IFMT) == S_IFDIR) {
+ if (S_ISDIR(statbuf.st_mode)) {
// This is a directory. Don't try to open, just create a new node with
// this path.
ScopedNode node(new DirFuseFsNode(this, fuse_ops_, fi, path_cstr));
@@ -102,7 +102,7 @@ Error FuseFs::OpenWithMode(const Path& path, int open_flags, mode_t mode,
return 0;
}
// Get mode.
- mode = statbuf.st_mode & ~S_IFMT;
+ mode = statbuf.st_mode & S_MODEBITS;
}
// Existing file.
@@ -189,7 +189,7 @@ Error FuseFs::Remove(const Path& path) {
node.reset();
- if ((statbuf.st_mode & S_IFMT) == S_IFDIR) {
+ if (S_ISDIR(statbuf.st_mode)) {
return Rmdir(path);
} else {
return Unlink(path);
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/dir_node.cc ('k') | native_client_sdk/src/libraries/nacl_io/kernel_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698