[sheepdog] [PATCH 09/14] net: skip memset for IPv6 in str_to_addr()

MORITA Kazutaka morita.kazutaka at gmail.com
Sat Aug 10 17:58:50 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 lib/net.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/net.c b/lib/net.c
index 3341970..720624f 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -472,9 +472,10 @@ uint8_t *str_to_addr(const char *ipstr, uint8_t *addr)
 {
 	int addr_start_idx = 0, af = strstr(ipstr, ":") ? AF_INET6 : AF_INET;
 
-	if (af == AF_INET)
+	if (af == AF_INET) {
 		addr_start_idx = 12;
-	memset(addr, 0, addr_start_idx);
+		memset(addr, 0, addr_start_idx);
+	}
 	if (!inet_pton(af, ipstr, addr + addr_start_idx))
 		return NULL;
 
-- 
1.7.9.5



More information about the sheepdog mailing list