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..6c5631f6deda8a69c803a8cd56b2a724caf1935c 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 & 0777; |
bradn
2014/10/20 17:17:34
So we're explicitly excluding things like suid?
|
} |
// 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); |