Fix some warnings in the resolver code.

This commit is contained in:
Jilles Tjoelker 2008-04-08 19:55:51 +02:00
parent 001b3b3633
commit cda884c6f2
2 changed files with 10 additions and 10 deletions

View File

@ -119,20 +119,20 @@ extern char irc_domain[HOSTLEN + 1];
static int res_ourserver(const struct rb_sockaddr_storage *inp) static int res_ourserver(const struct rb_sockaddr_storage *inp)
{ {
#ifdef RB_IPV6 #ifdef RB_IPV6
struct sockaddr_in6 *v6; const struct sockaddr_in6 *v6;
struct sockaddr_in6 *v6in = (struct sockaddr_in6 *)inp; const struct sockaddr_in6 *v6in = (const struct sockaddr_in6 *)inp;
#endif #endif
struct sockaddr_in *v4; const struct sockaddr_in *v4;
struct sockaddr_in *v4in = (struct sockaddr_in *)inp; const struct sockaddr_in *v4in = (const struct sockaddr_in *)inp;
int ns; int ns;
for (ns = 0; ns < irc_nscount; ns++) for (ns = 0; ns < irc_nscount; ns++)
{ {
const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns]; const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns];
#ifdef RB_IPV6 #ifdef RB_IPV6
v6 = (struct sockaddr_in6 *)srv; v6 = (const struct sockaddr_in6 *)srv;
#endif #endif
v4 = (struct sockaddr_in *)srv; v4 = (const struct sockaddr_in *)srv;
/* could probably just memcmp(srv, inp, srv.ss_len) here /* could probably just memcmp(srv, inp, srv.ss_len) here
* but we'll air on the side of caution - stu * but we'll air on the side of caution - stu
@ -225,7 +225,7 @@ static void start_resolver(void)
{ {
irc_res_init(); irc_res_init();
if (res_fd <= 0) /* there isn't any such thing as fd 0, that's just a myth. */ if (res_fd == NULL)
{ {
if ((res_fd = rb_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0, if ((res_fd = rb_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0,
"UDP resolver socket")) == NULL) "UDP resolver socket")) == NULL)
@ -440,7 +440,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
if (addr->ss_family == AF_INET) if (addr->ss_family == AF_INET)
{ {
struct sockaddr_in *v4 = (struct sockaddr_in *)addr; const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr;
cp = (const unsigned char *)&v4->sin_addr.s_addr; cp = (const unsigned char *)&v4->sin_addr.s_addr;
rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]), rb_sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]),
@ -449,7 +449,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
#ifdef RB_IPV6 #ifdef RB_IPV6
else if (addr->ss_family == AF_INET6) else if (addr->ss_family == AF_INET6)
{ {
struct sockaddr_in6 *v6 = (struct sockaddr_in6 *)addr; const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *)addr;
cp = (const unsigned char *)&v6->sin6_addr.s6_addr; cp = (const unsigned char *)&v6->sin6_addr.s6_addr;
(void)sprintf(request->queryname, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x." (void)sprintf(request->queryname, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x."

View File

@ -409,7 +409,7 @@ irc_ns_name_ntop(const char *src, char *dst, size_t dstsiz)
} }
*dn++ = '.'; *dn++ = '.';
} }
if ((l = labellen((unsigned char*)(cp - 1))) < 0) { if ((l = labellen((const unsigned char*)(cp - 1))) < 0) {
errno = EMSGSIZE; /* XXX */ errno = EMSGSIZE; /* XXX */
return(-1); return(-1);
} }