Commit b0e98718 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

src: Handle return value of getsockopt

parent 3d4a4cb6
......@@ -882,12 +882,11 @@ int create_nonblock_socket(int family) {
bool check_socket_connected(int fd) {
int error;
socklen_t len = sizeof(error);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0) {
if (error != 0) {
return false;
}
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) != 0) {
return false;
}
return true;
return error == 0;
}
bool ipv6_numeric_addr(const char *host) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment