diff options
author | mike <mike@FreeBSD.org> | 2001-12-01 03:43:01 +0000 |
---|---|---|
committer | mike <mike@FreeBSD.org> | 2001-12-01 03:43:01 +0000 |
commit | 20cacce16c233112fc71cb819fa0db765acba715 (patch) | |
tree | e691b950e4d1dd3407416b2bd0eed4f0f8ca57e5 /lib/libc/net | |
parent | 0d72b82e2e3d36c1011b9e4d84e5d4fe35279c05 (diff) | |
download | FreeBSD-src-20cacce16c233112fc71cb819fa0db765acba715.zip FreeBSD-src-20cacce16c233112fc71cb819fa0db765acba715.tar.gz |
o Stop abusing MD headers with non-MD types.
o Hide nonstandard functions and types in <netinet/in.h> when
_POSIX_SOURCE is defined.
o Add some missing types (required by POSIX.1-200x) to <netinet/in.h>.
o Restore vendor ID from Rev 1.1 in <netinet/in.h> and make use of new
__FBSDID() macro.
o Fix some miscellaneous issues in <arpa/inet.h>.
o Correct final argument for the inet_ntop() function (POSIX.1-200x).
o Get rid of the namespace pollution from <sys/types.h> in
<arpa/inet.h>.
Reviewed by: fenner
Partially submitted by: bde
Diffstat (limited to 'lib/libc/net')
-rw-r--r-- | lib/libc/net/inet.3 | 2 | ||||
-rw-r--r-- | lib/libc/net/inet_ntop.c | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/libc/net/inet.3 b/lib/libc/net/inet.3 index 3b51129..ff603fd 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 0b9449b..9dbe46b 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); } |