Fix a bug in the socket opening code
[tor-status] / src / torcontrol-socket.c
index a8002d0..1d95bd2 100644 (file)
@@ -54,12 +54,12 @@ int tor_control_open_socket (int port, GError **error) {
        }
 
        for (rp = result; rp != NULL; rp = rp->ai_next) {
-               sockfd = socket (result->ai_family, result->ai_socktype,
-                                result->ai_protocol);
+               sockfd = socket (rp->ai_family, rp->ai_socktype,
+                                rp->ai_protocol);
                if (sockfd == -1)
                        continue;
 
-               status = connect (sockfd, result->ai_addr, result->ai_addrlen);
+               status = connect (sockfd, rp->ai_addr, rp->ai_addrlen);
                if (status != -1)
                        break;