@cryptotaxi247 / netdata-1 / commits / 5e9d5dfae

Let the compiler choose the best way to clean sockaddr_in6 structure instead of using memset.

Frederico Lamberti Pissarra committed May 12, 2016 at 20:49 UTC 5e9d5dfaec245789ffe4e02cdfa5b62d436201d3
1 file changed +1 -4
src/web_server.c
+1 -4
@@ -115,7 +115,6 @@ int create_listen_socket6(const char *ip, int port, int listen_backlog)
115 {
116 int sock = -1;
117 int sockopt = 1;
118 - struct sockaddr_in6 name;
118
119 debug(D_LISTENER, "IPv6 creating new listening socket on port %d", port);
120
@@ -128,9 +127,7 @@ int create_listen_socket6(const char *ip, int port, int listen_backlog)
127 /* avoid "address already in use" */
128 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*)&sockopt, sizeof(sockopt));
129
131 - memset(&name, 0, sizeof(struct sockaddr_in6));
132 - name.sin6_family = AF_INET6;
133 - name.sin6_port = htons ((uint16_t) port);
130 + struct sockaddr_in6 name = { .sin6_family = AF_INET6, .sin6_port = htons((uint16_t)port) };
131
132 if(is_ip_anything(ip)) {
133 name.sin6_addr = in6addr_any;