libevent: extract evutil_socket_error and evutil_socket_error_to_string