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 fe4c8ec960c16986d9ffc1a9cf832aba8c83cd6a..be3fe66c54cde08e5af136c77df821d56c692576 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 |
@@ -57,7 +57,8 @@ void FuseFs::Destroy() { |
fuse_ops_->destroy(fuse_user_data_); |
} |
-Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
+Error FuseFs::OpenWithMode(const Path& path, int open_flags, mode_t mode, |
+ ScopedNode* out_node) { |
std::string path_str = path.Join(); |
const char* path_cstr = path_str.c_str(); |
int result = 0; |
@@ -69,7 +70,6 @@ Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
if (open_flags & (O_CREAT | O_EXCL)) { |
// According to the FUSE docs, open() is not called when O_CREAT or O_EXCL |
// is passed. |
- mode_t mode = S_IRALL | S_IWALL; |
if (fuse_ops_->create) { |
result = fuse_ops_->create(path_cstr, mode, &fi); |
if (result < 0) |
@@ -101,6 +101,8 @@ Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
*out_node = node; |
return 0; |
} |
+ // Get mode. |
+ mode = statbuf.st_mode & ~S_IFMT; |
} |
// Existing file. |
@@ -129,6 +131,7 @@ Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
Error error = node->Init(open_flags); |
if (error) |
return error; |
+ node->SetMode(mode); |
*out_node = node; |
return 0; |