summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-04-25 20:28:26 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-04-25 20:28:26 +0000
commitd426baad37cea7cf4e167aaf05301ec166e5cf5f (patch)
tree3b845f81ff8ef1ffcf282d46ad4b1918ff8ef0f8
parentc3dbc520a1d55c20ef10d626dadaf4c475ec3dd1 (diff)
fix a few warnings
-rw-r--r--lib/libc/asr/asr_debug.c24
-rw-r--r--lib/libc/asr/getaddrinfo_async.c4
-rw-r--r--lib/libc/asr/gethostnamadr_async.c6
-rw-r--r--lib/libc/asr/getnameinfo_async.c4
4 files changed, 22 insertions, 16 deletions
diff --git a/lib/libc/asr/asr_debug.c b/lib/libc/asr/asr_debug.c
index 47fb2337795..98f5fe8e2e9 100644
--- a/lib/libc/asr/asr_debug.c
+++ b/lib/libc/asr/asr_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr_debug.c,v 1.2 2012/04/15 21:42:58 eric Exp $ */
+/* $OpenBSD: asr_debug.c,v 1.3 2012/04/25 20:28:25 eric Exp $ */
/*
* Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org>
*
@@ -29,6 +29,8 @@
#include "asr.h"
#include "asr_private.h"
+char *print_addr(const struct sockaddr *, char *, size_t);
+
static void asr_vdebug(const char *, va_list);
static char *print_dname(const char *, char *, size_t);
@@ -194,8 +196,8 @@ print_rr(struct rr *rr, char *buf, size_t max)
print_dname(rr->rr.ptr.ptrname, buf, max);
break;
case T_SOA:
- snprintf(buf, max,
- "%s %s %" PRIu32 " %" PRIu32 " %" PRIu32 " %" PRIu32 " %" PRIu32,
+ snprintf(buf, max, "%s %s %" PRIu32 " %" PRIu32 " %" PRIu32
+ " %" PRIu32 " %" PRIu32,
print_dname(rr->rr.soa.rname, tmp, sizeof tmp),
print_dname(rr->rr.soa.mname, tmp2, sizeof tmp2),
rr->rr.soa.serial,
@@ -265,10 +267,12 @@ print_host(const struct sockaddr *sa, char *buf, size_t len)
{
switch (sa->sa_family) {
case AF_INET:
- inet_ntop(AF_INET, &((struct sockaddr_in*)sa)->sin_addr, buf, len);
+ inet_ntop(AF_INET, &((const struct sockaddr_in*)sa)->sin_addr,
+ buf, len);
break;
case AF_INET6:
- inet_ntop(AF_INET6, &((struct sockaddr_in6*)sa)->sin6_addr, buf, len);
+ inet_ntop(AF_INET6,
+ &((const struct sockaddr_in6*)sa)->sin6_addr, buf, len);
break;
default:
buf[0] = '\0';
@@ -286,11 +290,11 @@ print_addr(const struct sockaddr *sa, char *buf, size_t len)
switch (sa->sa_family) {
case AF_INET:
snprintf(buf, len, "%s:%i", h,
- ntohs(((struct sockaddr_in*)(sa))->sin_port));
+ ntohs(((const struct sockaddr_in*)(sa))->sin_port));
break;
case AF_INET6:
snprintf(buf, len, "[%s]:%i", h,
- ntohs(((struct sockaddr_in6*)(sa))->sin6_port));
+ ntohs(((const struct sockaddr_in6*)(sa))->sin6_port));
break;
default:
snprintf(buf, len, "?");
@@ -368,13 +372,15 @@ asr_dump(struct asr *a)
asr_printf(" ndots: %i\n", ac->ac_ndots);
asr_printf(" family:");
for(i = 0; ac->ac_family[i] != -1; i++)
- asr_printf(" %s", (ac->ac_family[i] == AF_INET) ? "inet" : "inet6");
+ asr_printf(" %s", (ac->ac_family[i] == AF_INET) ?
+ "inet" : "inet6");
asr_printf("\n");
asr_printf("NAMESERVERS timeout=%i retry=%i\n",
ac->ac_nstimeout,
ac->ac_nsretries);
for(i = 0; i < ac->ac_nscount; i++)
- asr_printf(" %s\n", print_addr(ac->ac_ns[i], buf, sizeof buf));
+ asr_printf(" %s\n", print_addr(ac->ac_ns[i], buf,
+ sizeof buf));
asr_printf("HOSTFILE %s\n", ac->ac_hostfile);
asr_printf("LOOKUP");
for(i = 0; i < ac->ac_dbcount; i++) {
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c
index b6c079c7850..180dffc3b15 100644
--- a/lib/libc/asr/getaddrinfo_async.c
+++ b/lib/libc/asr/getaddrinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo_async.c,v 1.1 2012/04/14 09:24:18 eric Exp $ */
+/* $OpenBSD: getaddrinfo_async.c,v 1.2 2012/04/25 20:28:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -269,7 +269,7 @@ getaddrinfo_async_run(struct async *as, struct async_res *ar)
async_set_state(as, ASR_STATE_NOT_FOUND);
break;
}
- if (r > sizeof(fqdn)) {
+ if (r > (int)sizeof(fqdn)) {
ar->ar_errno = EINVAL;
ar->ar_h_errno = NO_RECOVERY;
ar->ar_gai_errno = EAI_OVERFLOW;
diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c
index f4a777d39ac..535c523b014 100644
--- a/lib/libc/asr/gethostnamadr_async.c
+++ b/lib/libc/asr/gethostnamadr_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gethostnamadr_async.c,v 1.1 2012/04/14 09:24:18 eric Exp $ */
+/* $OpenBSD: gethostnamadr_async.c,v 1.2 2012/04/25 20:28:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -538,7 +538,7 @@ addr_as_fqdn(const char *addr, int family, char *dst, size_t max)
switch (family) {
case AF_INET:
- in_addr = ntohl(*((in_addr_t *)addr));
+ in_addr = ntohl(*((const in_addr_t *)addr));
snprintf(dst, max,
"%d.%d.%d.%d.in-addr.arpa.",
in_addr & 0xff,
@@ -547,7 +547,7 @@ addr_as_fqdn(const char *addr, int family, char *dst, size_t max)
(in_addr >> 24) & 0xff);
break;
case AF_INET6:
- in6_addr = (struct in6_addr *)addr;
+ in6_addr = (const struct in6_addr *)addr;
snprintf(dst, max,
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x."
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x."
diff --git a/lib/libc/asr/getnameinfo_async.c b/lib/libc/asr/getnameinfo_async.c
index 1ba853d0a7d..8ae109c6fa2 100644
--- a/lib/libc/asr/getnameinfo_async.c
+++ b/lib/libc/asr/getnameinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnameinfo_async.c,v 1.1 2012/04/14 09:24:18 eric Exp $ */
+/* $OpenBSD: getnameinfo_async.c,v 1.2 2012/04/25 20:28:25 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -232,7 +232,7 @@ _servname(struct async *as)
}
r = snprintf(buf, buflen, "%u", ntohs(port));
- if (r == -1 || r >= buflen)
+ if (r == -1 || r >= (int)buflen)
return (-1);
return (0);