From 7a7f490efab410e161429af5b50042c3b3152237 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Sat, 29 Sep 2007 14:34:59 +0000 Subject: [PATCH] Fix compiler warning in setsockopt(). --- ares/ares_process.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ares/ares_process.c b/ares/ares_process.c index 2171011e0..b2600df6c 100644 --- a/ares/ares_process.c +++ b/ares/ares_process.c @@ -230,7 +230,7 @@ static void write_tcp_data(ares_channel channel, } } } - + /* Consume the given number of bytes from the head of the TCP send queue. */ static void advance_tcp_send_queue(ares_channel channel, int whichserver, ssize_t num_bytes) @@ -746,18 +746,18 @@ static int configure_socket(int s, ares_channel channel) /* Set the socket's send and receive buffer sizes. */ if ((channel->socket_send_buffer_size > 0) && setsockopt(s, SOL_SOCKET, SO_SNDBUF, - &channel->socket_send_buffer_size, + (const void*)&channel->socket_send_buffer_size, sizeof(channel->socket_send_buffer_size)) == -1) return -1; - + if ((channel->socket_receive_buffer_size > 0) && setsockopt(s, SOL_SOCKET, SO_RCVBUF, - &channel->socket_receive_buffer_size, + (const void*)&channel->socket_receive_buffer_size, sizeof(channel->socket_receive_buffer_size)) == -1) return -1; return 0; - } + } static int open_tcp_socket(ares_channel channel, struct server_state *server) { @@ -784,7 +784,8 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) * isn't very interesting in general. */ opt = 1; - if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt)) == -1) + if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, + (const void*)&opt, sizeof(opt)) == -1) { close(s); return -1; @@ -983,8 +984,8 @@ static struct query *end_query (ares_channel channel, struct query *query, int s } } } - - /* Invoke the callback */ + + /* Invoke the callback */ query->callback(query->arg, status, query->timeouts, abuf, alen); for (q = &channel->queries; *q; q = &(*q)->next) {