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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_handle.cc

Issue 659513002: [NaCl SDK] nacl_io: ignore mode bits when creating files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 unified diff | Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/kernel_handle.h" 5 #include "nacl_io/kernel_handle.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <pthread.h> 8 #include <pthread.h>
9 9
10 #include "nacl_io/filesystem.h" 10 #include "nacl_io/filesystem.h"
(...skipping 22 matching lines...) Expand all
33 // Returns the SocketNode* if this node is a socket. 33 // Returns the SocketNode* if this node is a socket.
34 SocketNode* KernelHandle::socket_node() { 34 SocketNode* KernelHandle::socket_node() {
35 if (node_.get() && node_->IsaSock()) 35 if (node_.get() && node_->IsaSock())
36 return reinterpret_cast<SocketNode*>(node_.get()); 36 return reinterpret_cast<SocketNode*>(node_.get());
37 return NULL; 37 return NULL;
38 } 38 }
39 39
40 Error KernelHandle::Init(int open_flags) { 40 Error KernelHandle::Init(int open_flags) {
41 handle_attr_.flags = open_flags; 41 handle_attr_.flags = open_flags;
42 42
43 if (!node_->CanOpen(open_flags)) { 43 if ((open_flags & O_CREAT) == 0 && !node_->CanOpen(open_flags)) {
44 return EACCES; 44 return EACCES;
45 } 45 }
46 46
47 if (open_flags & O_APPEND) { 47 if (open_flags & O_APPEND) {
48 Error error = node_->GetSize(&handle_attr_.offs); 48 Error error = node_->GetSize(&handle_attr_.offs);
49 if (error) 49 if (error)
50 return error; 50 return error;
51 } 51 }
52 52
53 return 0; 53 return 0;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 return ENOTSOCK; 228 return ENOTSOCK;
229 if (OpenMode() == O_RDONLY) 229 if (OpenMode() == O_RDONLY)
230 return EACCES; 230 return EACCES;
231 231
232 AUTO_LOCK(handle_lock_); 232 AUTO_LOCK(handle_lock_);
233 return sock->SendTo(handle_attr_, buf, len, flags, dest_addr, addrlen, 233 return sock->SendTo(handle_attr_, buf, len, flags, dest_addr, addrlen,
234 out_len); 234 out_len);
235 } 235 }
236 236
237 } // namespace nacl_io 237 } // namespace nacl_io
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698