pidgin/pidgin

Fix IRC file transfers on Windows
release-2.x.y
2022-04-15, Belgin Știrbu
f20e9970a54f
Parents acd1360af5cb
Children c5c98b27f755
Fix IRC file transfers on Windows

This might also fix some other things, like getsockname
error #10014

Testing Done:
Tested on Windows and Linux. Executed some file transfers over IRC and they worked.

Bugs closed: PIDGIN-17175

Reviewed at https://reviews.imfreedom.org/r/1382/
--- a/libpurple/network.c Thu Apr 07 22:33:38 2022 -0500
+++ b/libpurple/network.c Fri Apr 15 11:13:22 2022 -0500
@@ -441,6 +441,14 @@
* XXX - Try IPv6 addresses first?
*/
for (next = res; next != NULL; next = next->ai_next) {
+#if _WIN32
+ /*
+ * On Windows, the address family for the transport
+ * address should always be set to AF_INET.
+ */
+ if(next->ai_family != AF_INET)
+ continue;
+#endif
listenfd = socket(next->ai_family, next->ai_socktype, next->ai_protocol);
if (listenfd < 0)
continue;
@@ -598,7 +606,7 @@
unsigned short
purple_network_get_port_from_fd(int fd)
{
- struct sockaddr_in addr;
+ common_sockaddr_t addr;
socklen_t len;
g_return_val_if_fail(fd >= 0, 0);
@@ -609,7 +617,7 @@
return 0;
}
- return ntohs(addr.sin_port);
+ return ntohs(addr.in.sin_port);
}
#ifdef _WIN32