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

Side by Side Diff: ipc/unix_domain_socket_util.cc

Issue 1636583002: ipc: remove unused variable from CreateClientUnixDomainSocket() function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « ipc/unix_domain_socket_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ipc/unix_domain_socket_util.h" 5 #include "ipc/unix_domain_socket_util.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stddef.h>
9 #include <sys/socket.h> 8 #include <sys/socket.h>
10 #include <sys/stat.h> 9 #include <sys/stat.h>
11 #include <sys/un.h> 10 #include <sys/un.h>
12 #include <unistd.h> 11 #include <unistd.h>
13 12
14 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
16 #include "base/files/scoped_file.h" 15 #include "base/files/scoped_file.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/posix/eintr_wrapper.h" 17 #include "base/posix/eintr_wrapper.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 110 }
112 111
113 *server_listen_fd = fd.release(); 112 *server_listen_fd = fd.release();
114 return true; 113 return true;
115 } 114 }
116 115
117 bool CreateClientUnixDomainSocket(const base::FilePath& socket_path, 116 bool CreateClientUnixDomainSocket(const base::FilePath& socket_path,
118 int* client_socket) { 117 int* client_socket) {
119 DCHECK(client_socket); 118 DCHECK(client_socket);
120 119
121 std::string socket_name = socket_path.value();
122 base::FilePath socket_dir = socket_path.DirName();
123
124 struct sockaddr_un unix_addr; 120 struct sockaddr_un unix_addr;
125 size_t unix_addr_len; 121 size_t unix_addr_len;
126 base::ScopedFD fd( 122 base::ScopedFD fd(
127 MakeUnixAddrForPath(socket_name, &unix_addr, &unix_addr_len)); 123 MakeUnixAddrForPath(socket_path.value(), &unix_addr, &unix_addr_len));
128 if (!fd.is_valid()) 124 if (!fd.is_valid())
129 return false; 125 return false;
130 126
131 if (HANDLE_EINTR(connect(fd.get(), reinterpret_cast<sockaddr*>(&unix_addr), 127 if (HANDLE_EINTR(connect(fd.get(), reinterpret_cast<sockaddr*>(&unix_addr),
132 unix_addr_len)) < 0) { 128 unix_addr_len)) < 0) {
133 PLOG(ERROR) << "connect " << socket_path.value(); 129 PLOG(ERROR) << "connect " << socket_path.value();
134 return false; 130 return false;
135 } 131 }
136 132
137 *client_socket = fd.release(); 133 *client_socket = fd.release();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // It's safe to keep listening on |server_listen_fd| even if the attempt to 189 // It's safe to keep listening on |server_listen_fd| even if the attempt to
194 // set O_NONBLOCK failed on the client fd. 190 // set O_NONBLOCK failed on the client fd.
195 return true; 191 return true;
196 } 192 }
197 193
198 *server_socket = accept_fd.release(); 194 *server_socket = accept_fd.release();
199 return true; 195 return true;
200 } 196 }
201 197
202 } // namespace IPC 198 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/unix_domain_socket_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698