got rid of all uses of strerror
This required some minor refactoring of other things and there were some
other small cleanups I noticed along the way.
diff --git a/aos/common/network/receive_socket.cc b/aos/common/network/receive_socket.cc
index 76a7a80..c3a7710 100644
--- a/aos/common/network/receive_socket.cc
+++ b/aos/common/network/receive_socket.cc
@@ -23,8 +23,7 @@
if (bind(socket_, &addr_.addr,
sizeof(addr_)) == -1) {
- LOG(ERROR, "failed to bind to address '%s' because of %d: %s\n", localhost,
- errno, strerror(errno));
+ PLOG(ERROR, "failed to bind to address '%s'", localhost);
return last_ret_ = -1;
}
return last_ret_ = 0;
diff --git a/aos/common/network/send_socket.cc b/aos/common/network/send_socket.cc
index 03bc57c..9886893 100644
--- a/aos/common/network/send_socket.cc
+++ b/aos/common/network/send_socket.cc
@@ -20,8 +20,7 @@
}
if (connect(socket_, &addr_.addr, sizeof(addr_)) < 0) {
- LOG(ERROR, "couldn't connect to ip '%s' because of %d: %s\n", robot_ip,
- errno, strerror(errno));
+ PLOG(ERROR, "couldn't connect to ip '%s'", robot_ip);
return last_ret_ = 1;
}
diff --git a/aos/common/network/socket.cc b/aos/common/network/socket.cc
index 4f6687e..b674ff1 100644
--- a/aos/common/network/socket.cc
+++ b/aos/common/network/socket.cc
@@ -13,8 +13,7 @@
int Socket::Connect(NetworkPort port, const char *address, int type) {
last_ret_ = 0;
if ((socket_ = socket(AF_INET, type, 0)) < 0) {
- LOG(ERROR, "failed to create socket because of %d: %s\n",
- errno, strerror(errno));
+ PLOG(ERROR, "failed to create socket");
return last_ret_ = 1;
}
@@ -27,8 +26,7 @@
const int failure_return = -1;
#endif
if (inet_aton(address, &addr_.in.sin_addr) == failure_return) {
- LOG(ERROR, "Invalid IP address '%s' because of %d: %s\n", address,
- errno, strerror(errno));
+ PLOG(ERROR, "invalid IP address '%s'", address);
return last_ret_ = -1;
}
@@ -69,8 +67,8 @@
if (errno == EINTR) {
return last_ret_ = 0;
}
- LOG(FATAL, "select(FD_SETSIZE, %p, NULL, NULL, %p) failed with %d: %s\n",
- &fds, &timeout_timeval, errno, strerror(errno));
+ PLOG(FATAL, "select(FD_SETSIZE, %p, NULL, NULL, %p) failed",
+ &fds, &timeout_timeval);
}
}