summaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
authorJuanJo Ciarlante <jjo@google.com>2009-10-05 12:24:20 +0200
committerJuanJo Ciarlante <juanjosec@gmail.com>2011-03-25 13:30:30 +0100
commitfc9a44e24299386b26f610a204656e30885c1ab5 (patch)
treefa96f9c874669306af4e145ea7e8c54ed4afd342 /socket.c
parente293510f9bb878faabb244f03ef4af97ddc67aad (diff)
downloadopenvpn-fc9a44e24299386b26f610a204656e30885c1ab5.tar.gz
openvpn-fc9a44e24299386b26f610a204656e30885c1ab5.tar.xz
openvpn-fc9a44e24299386b26f610a204656e30885c1ab5.zip
* socket.c: better buf logic in print_sockaddr_ex
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/socket.c b/socket.c
index 2bb7141..943cb58 100644
--- a/socket.c
+++ b/socket.c
@@ -2382,7 +2382,7 @@ print_sockaddr_ex (const struct openvpn_sockaddr *addr,
const unsigned int flags,
struct gc_arena *gc)
{
- struct buffer out;
+ struct buffer out = alloc_buf_gc (128, gc);
bool addr_is_defined;
if (!addr) {
return "[NULL]";
@@ -2395,7 +2395,6 @@ print_sockaddr_ex (const struct openvpn_sockaddr *addr,
#endif
{
const int port= ntohs (addr->addr.in4.sin_port);
- out = alloc_buf_gc (128, gc);
buf_puts (&out, "[AF_INET]");
mutex_lock_static (L_INET_NTOA);
buf_puts (&out, (addr_is_defined ? inet_ntoa (addr->addr.in4.sin_addr) : "[undef]"));
@@ -2416,7 +2415,6 @@ print_sockaddr_ex (const struct openvpn_sockaddr *addr,
{
const int port= ntohs (addr->addr.in6.sin6_port);
char buf[INET6_ADDRSTRLEN] = "[undef]";
- out = alloc_buf_gc (128, gc);
buf_puts (&out, "[AF_INET6]");
if (addr_is_defined)
{
@@ -2434,6 +2432,8 @@ print_sockaddr_ex (const struct openvpn_sockaddr *addr,
}
}
break;
+ default:
+ ASSERT(0);
}
#endif
return BSTR (&out);