| Index: runtime/bin/socket_linux.cc
|
| ===================================================================
|
| --- runtime/bin/socket_linux.cc (revision 14903)
|
| +++ runtime/bin/socket_linux.cc (working copy)
|
| @@ -9,6 +9,7 @@
|
| #include <unistd.h>
|
|
|
| #include "bin/fdutils.h"
|
| +#include "bin/log.h"
|
| #include "bin/socket.h"
|
|
|
|
|
| @@ -25,7 +26,7 @@
|
|
|
| fd = TEMP_FAILURE_RETRY(socket(AF_INET, SOCK_STREAM, 0));
|
| if (fd < 0) {
|
| - fprintf(stderr, "Error CreateConnect: %s\n", strerror(errno));
|
| + Log::PrintErr("Error CreateConnect: %s\n", strerror(errno));
|
| return -1;
|
| }
|
|
|
| @@ -38,7 +39,7 @@
|
| if (gethostbyname_r(
|
| host, &server, temp_buf, kTempBufSize, &unused, &err) != 0) {
|
| TEMP_FAILURE_RETRY(close(fd));
|
| - fprintf(stderr, "Error CreateConnect: %s\n", strerror(errno));
|
| + Log::PrintErr("Error CreateConnect: %s\n", strerror(errno));
|
| return -1;
|
| }
|
|
|
| @@ -96,7 +97,7 @@
|
| getsockname(fd,
|
| reinterpret_cast<struct sockaddr *>(&socket_address),
|
| &size))) {
|
| - fprintf(stderr, "Error getsockname: %s\n", strerror(errno));
|
| + Log::PrintErr("Error getsockname: %s\n", strerror(errno));
|
| return 0;
|
| }
|
| return ntohs(socket_address.sin_port);
|
| @@ -111,14 +112,14 @@
|
| getpeername(fd,
|
| reinterpret_cast<struct sockaddr *>(&socket_address),
|
| &size))) {
|
| - fprintf(stderr, "Error getpeername: %s\n", strerror(errno));
|
| + Log::PrintErr("Error getpeername: %s\n", strerror(errno));
|
| return false;
|
| }
|
| if (inet_ntop(socket_address.sin_family,
|
| reinterpret_cast<const void *>(&socket_address.sin_addr),
|
| host,
|
| INET_ADDRSTRLEN) == NULL) {
|
| - fprintf(stderr, "Error inet_ntop: %s\n", strerror(errno));
|
| + Log::PrintErr("Error inet_ntop: %s\n", strerror(errno));
|
| return false;
|
| }
|
| *port = ntohs(socket_address.sin_port);
|
| @@ -187,7 +188,7 @@
|
|
|
| fd = TEMP_FAILURE_RETRY(socket(AF_INET, SOCK_STREAM, 0));
|
| if (fd < 0) {
|
| - fprintf(stderr, "Error CreateBind: %s\n", strerror(errno));
|
| + Log::PrintErr("Error CreateBind: %s\n", strerror(errno));
|
| return -1;
|
| }
|
|
|
| @@ -205,12 +206,12 @@
|
| reinterpret_cast<struct sockaddr *>(&server_address),
|
| sizeof(server_address))) < 0) {
|
| TEMP_FAILURE_RETRY(close(fd));
|
| - fprintf(stderr, "Error Bind: %s\n", strerror(errno));
|
| + Log::PrintErr("Error Bind: %s\n", strerror(errno));
|
| return -1;
|
| }
|
|
|
| if (TEMP_FAILURE_RETRY(listen(fd, backlog)) != 0) {
|
| - fprintf(stderr, "Error Listen: %s\n", strerror(errno));
|
| + Log::PrintErr("Error Listen: %s\n", strerror(errno));
|
| return -1;
|
| }
|
|
|
|
|