| Index: runtime/bin/socket_android.cc
|
| diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc
|
| index 07e6894e6a8747995b3e17a35eec23b1a53436b4..ec1a43181a54199354459c3c5a24f6d4992efa32 100644
|
| --- a/runtime/bin/socket_android.cc
|
| +++ b/runtime/bin/socket_android.cc
|
| @@ -25,7 +25,7 @@
|
| namespace dart {
|
| namespace bin {
|
|
|
| -static void SaveErrorAndClose(intptr_t fd) {
|
| +static void FDUtils::SaveErrorAndClose(intptr_t fd) {
|
| int err = errno;
|
| VOID_TEMP_FAILURE_RETRY(close(fd));
|
| errno = err;
|
| @@ -63,7 +63,7 @@ static intptr_t Create(const RawAddr& addr) {
|
| return -1;
|
| }
|
| if (!FDUtils::SetCloseOnExec(fd)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
| return fd;
|
| @@ -76,7 +76,7 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) {
|
| if ((result == 0) || (errno == EINPROGRESS)) {
|
| return fd;
|
| }
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| @@ -88,7 +88,7 @@ intptr_t Socket::CreateConnect(const RawAddr& addr) {
|
| }
|
|
|
| if (!FDUtils::SetNonBlocking(fd)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
| return Connect(fd, addr);
|
| @@ -105,7 +105,7 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
|
| intptr_t result = TEMP_FAILURE_RETRY(
|
| bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr)));
|
| if ((result != 0) && (errno != EINPROGRESS)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| @@ -323,7 +323,7 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) {
|
| }
|
|
|
| if (!FDUtils::SetCloseOnExec(fd)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| @@ -335,12 +335,12 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) {
|
|
|
| if (NO_RETRY_EXPECTED(
|
| bind(fd, &addr.addr, SocketAddress::GetAddrLength(addr))) < 0) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| if (!FDUtils::SetNonBlocking(fd)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
| return fd;
|
| @@ -377,7 +377,7 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
|
| }
|
|
|
| if (!FDUtils::SetCloseOnExec(fd)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| @@ -393,7 +393,7 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
|
|
|
| if (NO_RETRY_EXPECTED(
|
| bind(fd, &addr.addr, SocketAddress::GetAddrLength(addr))) < 0) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| @@ -403,17 +403,17 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
|
| // Don't close the socket until we have created a new socket, ensuring
|
| // that we do not get the bad port number again.
|
| intptr_t new_fd = CreateBindListen(addr, backlog, v6_only);
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return new_fd;
|
| }
|
|
|
| if (NO_RETRY_EXPECTED(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
|
|
| if (!FDUtils::SetNonBlocking(fd)) {
|
| - SaveErrorAndClose(fd);
|
| + FDUtils::SaveErrorAndClose(fd);
|
| return -1;
|
| }
|
| return fd;
|
| @@ -451,11 +451,11 @@ intptr_t ServerSocket::Accept(intptr_t fd) {
|
| }
|
| } else {
|
| if (!FDUtils::SetCloseOnExec(socket)) {
|
| - SaveErrorAndClose(socket);
|
| + FDUtils::SaveErrorAndClose(socket);
|
| return -1;
|
| }
|
| if (!FDUtils::SetNonBlocking(socket)) {
|
| - SaveErrorAndClose(socket);
|
| + FDUtils::SaveErrorAndClose(socket);
|
| return -1;
|
| }
|
| }
|
|
|