diff options
author | paul <paul> | 2004-10-13 05:22:18 +0000 |
---|---|---|
committer | paul <paul> | 2004-10-13 05:22:18 +0000 |
commit | 42d498658d85e36a7e5910955e7425b1fa2afa69 (patch) | |
tree | 4745462eb34a84e32ef5d3e1586a3cb5a983626e /lib/sockunion.c | |
parent | fd79ac918b8feaacebe9719adaac97dffb69137a (diff) | |
download | quagga-42d498658d85e36a7e5910955e7425b1fa2afa69.tar.bz2 quagga-42d498658d85e36a7e5910955e7425b1fa2afa69.tar.xz |
2004-10-13 Paul Jakma <paul@dishone.st>
* (global) more const'ification.
* sockunion.c: (sockunion_su2str) buffer should be sized
SU_ADDRSTRLEN.
(sockunion_log) do not return stack variables, strdup buf before
return.
* vty.h: Fix up the VTY_GET_INTEGER macros. Testing caller supplied
values against ULONG_MAX is daft, when caller probably has passed
a type that can not hold ULONG_MAX. use a temporary long instead.
Add VTY_GET_LONG, make VTY_GET_INTEGER_RANGE use it, make
VTY_GET_INTEGER a define for VTY_GET_INTEGER_RANGE.
Diffstat (limited to 'lib/sockunion.c')
-rw-r--r-- | lib/sockunion.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sockunion.c b/lib/sockunion.c index eb29ced2..78e02f26 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -175,7 +175,7 @@ sockunion2str (union sockunion *su, char *buf, size_t len) } union sockunion * -sockunion_str2su (char *str) +sockunion_str2su (const char *str) { int ret; union sockunion *su; @@ -211,7 +211,7 @@ sockunion_str2su (char *str) char * sockunion_su2str (union sockunion *su) { - char str[INET6_ADDRSTRLEN]; + char str[SU_ADDRSTRLEN]; switch (su->sa.sa_family) { @@ -314,7 +314,7 @@ sockunion_log (union sockunion *su) snprintf (buf, SU_ADDRSTRLEN, "af_unknown %d ", su->sa.sa_family); break; } - return buf; + return (strdup (buf)); } /* sockunion_connect returns @@ -676,7 +676,7 @@ sockunion_print (union sockunion *su) #ifdef HAVE_IPV6 case AF_INET6: { - char buf [64]; + char buf [SU_ADDRSTRLEN]; printf ("%s\n", inet_ntop (AF_INET6, &(su->sin6.sin6_addr), buf, sizeof (buf))); |