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

Side by Side Diff: mojo/edk/embedder/named_platform_handle_utils_posix.cc

Issue 2444793002: Allow custom security descriptors when creating named pipes on Windows. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "mojo/edk/embedder/named_platform_handle_utils.h" 5 #include "mojo/edk/embedder/named_platform_handle_utils.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 #include <sys/un.h> 9 #include <sys/un.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (HANDLE_EINTR(connect(handle.get().handle, 92 if (HANDLE_EINTR(connect(handle.get().handle,
93 reinterpret_cast<sockaddr*>(&unix_addr), 93 reinterpret_cast<sockaddr*>(&unix_addr),
94 unix_addr_len)) < 0) { 94 unix_addr_len)) < 0) {
95 PLOG(ERROR) << "connect " << named_handle.name; 95 PLOG(ERROR) << "connect " << named_handle.name;
96 return ScopedPlatformHandle(); 96 return ScopedPlatformHandle();
97 } 97 }
98 98
99 return handle; 99 return handle;
100 } 100 }
101 101
102 ScopedPlatformHandle CreateServerHandle(const NamedPlatformHandle& named_handle, 102 ScopedPlatformHandle CreateServerHandle(
103 bool enforce_uniqueness) { 103 const NamedPlatformHandle& named_handle,
104 CHECK(!enforce_uniqueness); 104 const CreateServerHandleOptions& options) {
105 if (!named_handle.is_valid()) 105 if (!named_handle.is_valid())
106 return ScopedPlatformHandle(); 106 return ScopedPlatformHandle();
107 107
108 // Make sure the path we need exists. 108 // Make sure the path we need exists.
109 base::FilePath socket_dir = base::FilePath(named_handle.name).DirName(); 109 base::FilePath socket_dir = base::FilePath(named_handle.name).DirName();
110 if (!base::CreateDirectory(socket_dir)) { 110 if (!base::CreateDirectory(socket_dir)) {
111 LOG(ERROR) << "Couldn't create directory: " << socket_dir.value(); 111 LOG(ERROR) << "Couldn't create directory: " << socket_dir.value();
112 return ScopedPlatformHandle(); 112 return ScopedPlatformHandle();
113 } 113 }
114 114
(...skipping 23 matching lines...) Expand all
138 if (listen(handle.get().handle, SOMAXCONN) < 0) { 138 if (listen(handle.get().handle, SOMAXCONN) < 0) {
139 PLOG(ERROR) << "listen " << named_handle.name; 139 PLOG(ERROR) << "listen " << named_handle.name;
140 unlink(named_handle.name.c_str()); 140 unlink(named_handle.name.c_str());
141 return ScopedPlatformHandle(); 141 return ScopedPlatformHandle();
142 } 142 }
143 return handle; 143 return handle;
144 } 144 }
145 145
146 } // namespace edk 146 } // namespace edk
147 } // namespace mojo 147 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/named_platform_handle_utils.h ('k') | mojo/edk/embedder/named_platform_handle_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698