Chromium Code Reviews| Index: runtime/bin/socket_android.cc |
| =================================================================== |
| --- runtime/bin/socket_android.cc (revision 14977) |
| +++ runtime/bin/socket_android.cc (working copy) |
| @@ -9,6 +9,7 @@ |
| #include <unistd.h> |
| #include "bin/fdutils.h" |
| +#include "bin/log.h" |
| #include "bin/socket.h" |
|
Ivan Posva
2012/11/17 01:13:42
While you are in this code, can you please move th
gram
2012/11/19 17:38:56
Done.
|
| @@ -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; |
| } |
| @@ -35,7 +36,7 @@ |
| server = gethostbyname(host); |
| if (server == NULL) { |
| TEMP_FAILURE_RETRY(close(fd)); |
| - fprintf(stderr, "Error CreateConnect: %s\n", strerror(errno)); |
| + Log::PrintErr("Error CreateConnect: %s\n", strerror(errno)); |
| return -1; |
| } |
| @@ -93,7 +94,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); |
| @@ -108,14 +109,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); |
| @@ -185,7 +186,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; |
| } |