summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2004-09-16 21:27:45 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2004-09-16 21:27:45 +0000
commit02ae7ba2d7fa92e17b48112f819c79f168b2255d (patch)
treece1d322b9a1c78dd0f68c1cf7eb65241f4148c19 /usr.sbin/dhcpd
parent8c77bed3e0823e33b4019f7cb62a426fdc11647c (diff)
Use inet_ntop() instead of inet_ntoa() in piaddr. This solves a problem
where inet_ntoa() was called twice per log message -- once here and once directly. This is a workaround acctually no static buffer should be used. OK deraadt@
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r--usr.sbin/dhcpd/inet.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/dhcpd/inet.c b/usr.sbin/dhcpd/inet.c
index 788abcdfc83..6255b37184f 100644
--- a/usr.sbin/dhcpd/inet.c
+++ b/usr.sbin/dhcpd/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.4 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: inet.c,v 1.5 2004/09/16 21:27:44 claudio Exp $ */
/*
* Subroutines to manipulate internet addresses in a safely portable
@@ -141,18 +141,13 @@ char *
piaddr(struct iaddr addr)
{
static char pbuf[32];
- struct in_addr a;
- char *s;
-
- memcpy(&a, &(addr.iabuf), sizeof(struct in_addr));
+ const char *s;
if (addr.len == 0)
strlcpy(pbuf, "<null address>", sizeof(pbuf));
else {
- s = inet_ntoa(a);
- if (s != NULL)
- strlcpy(pbuf, s, sizeof(pbuf));
- else
+ s = inet_ntop(AF_INET, &addr.iabuf, pbuf, sizeof pbuf);
+ if (s == NULL)
strlcpy(pbuf, "<invalid address>", sizeof(pbuf));
}
return (pbuf);