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

Side by Side Diff: net/socket/unix_domain_socket_posix.cc

Issue 100253002: Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/tcp_socket_libevent.cc ('k') | net/socket/unix_domain_socket_posix_unittest.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 "net/socket/unix_domain_socket_posix.h" 5 #include "net/socket/unix_domain_socket_posix.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <string> 8 #include <string>
9 9
10 #include <errno.h> 10 #include <errno.h>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 memcpy(addr.sun_path + 1, path.c_str(), path.size()); 123 memcpy(addr.sun_path + 1, path.c_str(), path.size());
124 addr_len = path.size() + offsetof(struct sockaddr_un, sun_path) + 1; 124 addr_len = path.size() + offsetof(struct sockaddr_un, sun_path) + 1;
125 } else { 125 } else {
126 memcpy(addr.sun_path, path.c_str(), path.size()); 126 memcpy(addr.sun_path, path.c_str(), path.size());
127 addr_len = sizeof(sockaddr_un); 127 addr_len = sizeof(sockaddr_un);
128 } 128 }
129 if (bind(s, reinterpret_cast<sockaddr*>(&addr), addr_len)) { 129 if (bind(s, reinterpret_cast<sockaddr*>(&addr), addr_len)) {
130 LOG(ERROR) << "Could not bind unix domain socket to " << path; 130 LOG(ERROR) << "Could not bind unix domain socket to " << path;
131 if (use_abstract_namespace) 131 if (use_abstract_namespace)
132 LOG(ERROR) << " (with abstract namespace enabled)"; 132 LOG(ERROR) << " (with abstract namespace enabled)";
133 if (HANDLE_EINTR(close(s)) < 0) 133 if (IGNORE_EINTR(close(s)) < 0)
134 LOG(ERROR) << "close() error"; 134 LOG(ERROR) << "close() error";
135 return kInvalidSocket; 135 return kInvalidSocket;
136 } 136 }
137 return s; 137 return s;
138 } 138 }
139 139
140 void UnixDomainSocket::Accept() { 140 void UnixDomainSocket::Accept() {
141 SocketDescriptor conn = StreamListenSocket::AcceptSocket(); 141 SocketDescriptor conn = StreamListenSocket::AcceptSocket();
142 if (conn == kInvalidSocket) 142 if (conn == kInvalidSocket)
143 return; 143 return;
144 uid_t user_id; 144 uid_t user_id;
145 gid_t group_id; 145 gid_t group_id;
146 if (!GetPeerIds(conn, &user_id, &group_id) || 146 if (!GetPeerIds(conn, &user_id, &group_id) ||
147 !auth_callback_.Run(user_id, group_id)) { 147 !auth_callback_.Run(user_id, group_id)) {
148 if (HANDLE_EINTR(close(conn)) < 0) 148 if (IGNORE_EINTR(close(conn)) < 0)
149 LOG(ERROR) << "close() error"; 149 LOG(ERROR) << "close() error";
150 return; 150 return;
151 } 151 }
152 scoped_ptr<UnixDomainSocket> sock( 152 scoped_ptr<UnixDomainSocket> sock(
153 new UnixDomainSocket(conn, socket_delegate_, auth_callback_)); 153 new UnixDomainSocket(conn, socket_delegate_, auth_callback_));
154 // It's up to the delegate to AddRef if it wants to keep it around. 154 // It's up to the delegate to AddRef if it wants to keep it around.
155 sock->WatchSocket(WAITING_READ); 155 sock->WatchSocket(WAITING_READ);
156 socket_delegate_->DidAccept(this, sock.PassAs<StreamListenSocket>()); 156 socket_delegate_->DidAccept(this, sock.PassAs<StreamListenSocket>());
157 } 157 }
158 158
(...skipping 28 matching lines...) Expand all
187 UnixDomainSocketWithAbstractNamespaceFactory::CreateAndListen( 187 UnixDomainSocketWithAbstractNamespaceFactory::CreateAndListen(
188 StreamListenSocket::Delegate* delegate) const { 188 StreamListenSocket::Delegate* delegate) const {
189 return UnixDomainSocket::CreateAndListenWithAbstractNamespace( 189 return UnixDomainSocket::CreateAndListenWithAbstractNamespace(
190 path_, fallback_path_, delegate, auth_callback_) 190 path_, fallback_path_, delegate, auth_callback_)
191 .PassAs<StreamListenSocket>(); 191 .PassAs<StreamListenSocket>();
192 } 192 }
193 193
194 #endif 194 #endif
195 195
196 } // namespace net 196 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_socket_libevent.cc ('k') | net/socket/unix_domain_socket_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698