summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'native_client_sdk/src/libraries/nacl_io/kernel_handle.cc')
-rw-r--r--native_client_sdk/src/libraries/nacl_io/kernel_handle.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc b/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
index f7bf163..4f88bbf 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_handle.cc
@@ -44,6 +44,11 @@ Error KernelHandle::Init(int open_flags) {
return EACCES;
}
+ // Directories can only be opened read-only.
+ if ((open_flags & 3) != O_RDONLY && node_->IsaDir()) {
+ return EISDIR;
+ }
+
if (open_flags & O_APPEND) {
Error error = node_->GetSize(&handle_attr_.offs);
if (error)