No need for the `(int)` cast on `item`, right? `curl_socket_t` is just a typedef to an `int`.

What if `getsockname` returns an error?