diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2015-06-23 13:52:25 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2015-06-23 13:52:25 +0800 |
commit | 3e29dadae46fe4d1e26ff91c30d9d3b84eb6d84e (patch) | |
tree | 3ea6987071d2c989d22186338945d014c1f744ed /gio/ginetaddress.c | |
parent | fd789f118741d89df348ba21ddc1d813da02fb76 (diff) | |
download | glib-3e29dadae46fe4d1e26ff91c30d9d3b84eb6d84e.tar.gz |
gio/ginetaddress.c: Fix Windows XP inet_pton() Emulation
We need to be more careful when we try to assign values to gpointers, so
that means we have to assign the value to the properly-dereference
gpointer, so that the assigned value will be retained after the function
returns. This code will be dropped soon, but it is done for XP
compatibility's sake for 2.44.
Should fix the issue reported in bug 730352 comment #24.
Diffstat (limited to 'gio/ginetaddress.c')
-rw-r--r-- | gio/ginetaddress.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c index 8723c28fe..39610ae97 100644 --- a/gio/ginetaddress.c +++ b/gio/ginetaddress.c @@ -417,7 +417,8 @@ inet_pton (gint family, /* XXX: Figure out when WSAStringToAddress() accepts a IPv4 address but the numbers-and-dots address is actually not complete. This code will be removed once XP/Server 2003 support is dropped... */ - addr = &sin->sin_addr; + *(IN_ADDR *) addr = sin->sin_addr; + return 1; } } @@ -425,7 +426,7 @@ inet_pton (gint family, { if (WSAStringToAddress ((LPTSTR) addr_string, AF_INET6, NULL, (LPSOCKADDR) &sa, &len) == 0) { - addr = &sin6->sin6_addr; + *(IN6_ADDR *) addr = sin6->sin6_addr; return 1; } } |