Index: native_client_sdk/src/libraries/nacl_io/node.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/node.cc b/native_client_sdk/src/libraries/nacl_io/node.cc |
index b91726fb1199bbaee73fe10f7b61904a4a755f2b..d8c1e03f96432cf1657f8f66ecaa9b90eb711eb7 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/node.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/node.cc |
@@ -189,7 +189,7 @@ int Node::GetLinks() { |
} |
int Node::GetMode() { |
- return stat_.st_mode & ~S_IFMT; |
+ return stat_.st_mode & 0777; |
} |
Error Node::GetSize(off_t* out_size) { |
@@ -203,13 +203,12 @@ int Node::GetType() { |
void Node::SetType(int type) { |
assert((type & ~S_IFMT) == 0); |
- stat_.st_mode &= ~S_IFMT; |
stat_.st_mode |= type; |
} |
void Node::SetMode(int mode) { |
- assert((mode & S_IFMT) == 0); |
- stat_.st_mode &= S_IFMT; |
+ assert((mode & ~0777) == 0); |
+ stat_.st_mode &= ~0777; |
stat_.st_mode |= mode; |
} |