gsocket: fix joining/leaving multicast groups

Initialize the structure passed to setsockopt to 0 to avoid random
errors when joining or leaving a multicast group.

https://bugzilla.gnome.org/show_bug.cgi?id=688378
This commit is contained in:
Wim Taymans 2012-11-15 11:37:20 +01:00 committed by Dan Winship
parent 49db979922
commit c2acbc0182

View File

@ -1952,6 +1952,7 @@ g_socket_multicast_group_operation (GSocket *socket,
struct ip_mreq mc_req;
#endif
memset (&mc_req, 0, sizeof (mc_req));
memcpy (&mc_req.imr_multiaddr, native_addr, sizeof (struct in_addr));
#ifdef HAVE_IP_MREQN
@ -1985,6 +1986,7 @@ g_socket_multicast_group_operation (GSocket *socket,
{
struct ipv6_mreq mc_req_ipv6;
memset (&mc_req_ipv6, 0, sizeof (mc_req_ipv6));
memcpy (&mc_req_ipv6.ipv6mr_multiaddr, native_addr, sizeof (struct in6_addr));
#ifdef HAVE_IF_NAMETOINDEX
if (iface)