summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMike Barcroft <mike@FreeBSD.org>2001-12-01 03:43:01 +0000
committerMike Barcroft <mike@FreeBSD.org>2001-12-01 03:43:01 +0000
commitde2656d0ed099c138c38bf578e1df33d9bcc3634 (patch)
treee691b950e4d1dd3407416b2bd0eed4f0f8ca57e5 /lib/libc
parent60363fb9f79a74440348d9ea5d505444e2028c90 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/inet.32
-rw-r--r--lib/libc/net/inet_ntop.c21
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/libc/net/inet.3 b/lib/libc/net/inet.3
index 3b51129bdf28..ff603fdc6937 100644
--- a/lib/libc/net/inet.3
+++ b/lib/libc/net/inet.3
@@ -62,7 +62,7 @@
.Ft char *
.Fn inet_ntoa "struct in_addr in"
.Ft const char *
-.Fn inet_ntop "int af" "const void *src" "char *dst" "size_t size"
+.Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size"
.Ft int
.Fn inet_pton "int af" "const char *src" "void *dst"
.Ft struct in_addr
diff --git a/lib/libc/net/inet_ntop.c b/lib/libc/net/inet_ntop.c
index 0b9449b0d81f..9dbe46b83a89 100644
--- a/lib/libc/net/inet_ntop.c
+++ b/lib/libc/net/inet_ntop.c
@@ -15,9 +15,12 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$FreeBSD$";
+static char rcsid[] = "$Id: inet_ntop.c,v 8.7 1996/08/05 08:41:18 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -28,15 +31,17 @@ static char rcsid[] = "$FreeBSD$";
#include <stdio.h>
#include <string.h>
-#define SPRINTF(x) ((size_t)sprintf x)
+#define SPRINTF(x) ((socklen_t)sprintf x)
/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size));
-static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size));
+static const char *inet_ntop4 __P((const u_char *src, char *dst,
+ socklen_t size));
+static const char *inet_ntop6 __P((const u_char *src, char *dst,
+ socklen_t size));
/* char *
* inet_ntop(af, src, dst, size)
@@ -51,7 +56,7 @@ inet_ntop(af, src, dst, size)
int af;
const void *src;
char *dst;
- size_t size;
+ socklen_t size;
{
switch (af) {
case AF_INET:
@@ -80,7 +85,7 @@ static const char *
inet_ntop4(src, dst, size)
const u_char *src;
char *dst;
- size_t size;
+ socklen_t size;
{
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
@@ -103,7 +108,7 @@ static const char *
inet_ntop6(src, dst, size)
const u_char *src;
char *dst;
- size_t size;
+ socklen_t size;
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
@@ -182,7 +187,7 @@ inet_ntop6(src, dst, size)
/*
* Check for overflow, copy, and we're done.
*/
- if ((size_t)(tp - tmp) > size) {
+ if ((socklen_t)(tp - tmp) > size) {
errno = ENOSPC;
return (NULL);
}