Index: net/socket/unix_domain_server_socket_posix.cc |
diff --git a/net/socket/unix_domain_server_socket_posix.cc b/net/socket/unix_domain_server_socket_posix.cc |
index a81f1ce033af0ea6a87f28e4b1c04c8c88012184..4ab0b834e624e81c94da14cc9dae2048b2d49ed0 100644 |
--- a/net/socket/unix_domain_server_socket_posix.cc |
+++ b/net/socket/unix_domain_server_socket_posix.cc |
@@ -63,13 +63,13 @@ int UnixDomainServerSocket::ListenWithAddressAndPort( |
return ERR_ADDRESS_INVALID; |
} |
- listen_socket_.reset(new SocketLibevent); |
- int rv = listen_socket_->Open(AF_UNIX); |
+ scoped_ptr<SocketLibevent> socket(new SocketLibevent); |
+ int rv = socket->Open(AF_UNIX); |
DCHECK_NE(ERR_IO_PENDING, rv); |
if (rv != OK) |
return rv; |
- rv = listen_socket_->Bind(address); |
+ rv = socket->Bind(address); |
DCHECK_NE(ERR_IO_PENDING, rv); |
if (rv != OK) { |
PLOG(ERROR) |
@@ -78,7 +78,13 @@ int UnixDomainServerSocket::ListenWithAddressAndPort( |
return rv; |
} |
- return listen_socket_->Listen(backlog); |
+ rv = socket->Listen(backlog); |
+ DCHECK_NE(ERR_IO_PENDING, rv); |
+ if (rv != OK) |
+ return rv; |
+ |
+ listen_socket_.swap(socket); |
+ return rv; |
} |
int UnixDomainServerSocket::GetLocalAddress(IPEndPoint* address) const { |