summaryrefslogtreecommitdiffstats
path: root/lib/libc/inet/inet_ntoa.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2007-06-11 07:21:21 +0000
committerdelphij <delphij@FreeBSD.org>2007-06-11 07:21:21 +0000
commit0325fb6ca4e8ecfa891d252d9d442141ad32847b (patch)
treed64971ce8313ba1ded2f2e6067ba93c54bc1e7ec /lib/libc/inet/inet_ntoa.c
parent219bfe35e701b456e351b70d8d9b05418b7057d8 (diff)
downloadFreeBSD-src-0325fb6ca4e8ecfa891d252d9d442141ad32847b.zip
FreeBSD-src-0325fb6ca4e8ecfa891d252d9d442141ad32847b.tar.gz
Add inet_ntoa_r, a reentrant version of inet_ntoa. This is
available on a lot of platforms, as well as libkern for years. Submitted by: "MQ"
Diffstat (limited to 'lib/libc/inet/inet_ntoa.c')
-rw-r--r--lib/libc/inet/inet_ntoa.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/inet/inet_ntoa.c b/lib/libc/inet/inet_ntoa.c
index 7e29145..b75a983 100644
--- a/lib/libc/inet/inet_ntoa.c
+++ b/lib/libc/inet/inet_ntoa.c
@@ -59,11 +59,19 @@ inet_ntoa(struct in_addr in) {
return (ret);
}
+char *
+inet_ntoa_r(struct in_addr in, char *buf)
+{
+ (void) inet_ntop(AF_INET, &in, buf, sizeof("255.255.255.255"));
+ return (buf);
+}
+
/*
* Weak aliases for applications that use certain private entry points,
* and fail to include <arpa/inet.h>.
*/
#undef inet_ntoa
__weak_reference(__inet_ntoa, inet_ntoa);
+__weak_reference(__inet_ntoa_r, inet_ntoa_r);
/*! \file */
OpenPOWER on IntegriCloud