mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Merge branch 'win32-network-monitor-error' into 'main'
gwin32networkmonitor: Fix returning address of local variable See merge request GNOME/glib!3425
This commit is contained in:
commit
1461c29301
@ -78,24 +78,24 @@ g_win32_network_monitor_init (GWin32NetworkMonitor *win)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
win_network_monitor_get_ip_info (IP_ADDRESS_PREFIX prefix,
|
||||
GSocketFamily *family,
|
||||
const guint8 **dest,
|
||||
gsize *len)
|
||||
win_network_monitor_get_ip_info (const IP_ADDRESS_PREFIX *prefix,
|
||||
GSocketFamily *family,
|
||||
const guint8 **dest,
|
||||
gsize *len)
|
||||
{
|
||||
switch (prefix.Prefix.si_family)
|
||||
switch (prefix->Prefix.si_family)
|
||||
{
|
||||
case AF_UNSPEC:
|
||||
/* Fall-through: AF_UNSPEC deliveres both IPV4 and IPV6 infos, let`s stick with IPV4 here */
|
||||
case AF_INET:
|
||||
*family = G_SOCKET_FAMILY_IPV4;
|
||||
*dest = (guint8 *) &prefix.Prefix.Ipv4.sin_addr;
|
||||
*len = prefix.PrefixLength;
|
||||
*dest = (guint8 *) &(prefix->Prefix.Ipv4.sin_addr);
|
||||
*len = prefix->PrefixLength;
|
||||
break;
|
||||
case AF_INET6:
|
||||
*family = G_SOCKET_FAMILY_IPV6;
|
||||
*dest = (guint8 *) &prefix.Prefix.Ipv6.sin6_addr;
|
||||
*len = prefix.PrefixLength;
|
||||
*dest = (guint8 *) &(prefix->Prefix.Ipv6.sin6_addr);
|
||||
*len = prefix->PrefixLength;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
@ -152,7 +152,7 @@ win_network_monitor_process_table (GWin32NetworkMonitor *win,
|
||||
|
||||
route = routes->Table + i;
|
||||
|
||||
if (!win_network_monitor_get_ip_info (route->DestinationPrefix, &family, &dest, &len))
|
||||
if (!win_network_monitor_get_ip_info (&route->DestinationPrefix, &family, &dest, &len))
|
||||
continue;
|
||||
|
||||
network = get_network_mask (family, dest, len);
|
||||
@ -218,13 +218,13 @@ win_network_monitor_invoke_route_changed (gpointer user_data)
|
||||
switch (route_data->type)
|
||||
{
|
||||
case MibDeleteInstance:
|
||||
if (!win_network_monitor_get_ip_info (route_data->route->DestinationPrefix, &family, &dest, &len))
|
||||
if (!win_network_monitor_get_ip_info (&route_data->route->DestinationPrefix, &family, &dest, &len))
|
||||
break;
|
||||
|
||||
remove_network (route_data->win, family, dest, len);
|
||||
break;
|
||||
case MibAddInstance:
|
||||
if (!win_network_monitor_get_ip_info (route_data->route->DestinationPrefix, &family, &dest, &len))
|
||||
if (!win_network_monitor_get_ip_info (&route_data->route->DestinationPrefix, &family, &dest, &len))
|
||||
break;
|
||||
|
||||
add_network (route_data->win, family, dest, len);
|
||||
|
Loading…
Reference in New Issue
Block a user