summarylogtreecommitdiffstats
path: root/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch
diff options
context:
space:
mode:
Diffstat (limited to '0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch')
-rw-r--r--0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch b/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch
new file mode 100644
index 00000000000..33ff4a96a55
--- /dev/null
+++ b/0001-interfaces-Add-debug-logging-to-sockaddr_to_string.patch
@@ -0,0 +1,46 @@
+From c7c78c964850172768a7ad062578b36913d3ce59 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Thu, 9 Jul 2020 16:43:19 +0530
+Subject: [PATCH 1/4] interfaces: Add debug logging to sockaddr_to_string
+
+Helps when you forgot to call WSAStartup, for instance.
+---
+ agent/interfaces.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/agent/interfaces.c b/agent/interfaces.c
+index 95e64a8..5c8d131 100644
+--- a/agent/interfaces.c
++++ b/agent/interfaces.c
+@@ -89,14 +89,25 @@ sockaddr_to_string (const struct sockaddr *addr)
+ size_t addr_len;
+
+ switch (addr->sa_family) {
+- case AF_INET: addr_len = sizeof (struct sockaddr_in); break;
+- case AF_INET6: addr_len = sizeof (struct sockaddr_in6); break;
+- default: return NULL;
++ case AF_INET:
++ addr_len = sizeof (struct sockaddr_in);
++ break;
++ case AF_INET6:
++ addr_len = sizeof (struct sockaddr_in6);
++ break;
++ default:
++ nice_debug ("Unknown sockaddr family: %i", addr->sa_family);
++ return NULL;
+ }
+
+ if (getnameinfo (addr, addr_len,
+ addr_as_string, sizeof (addr_as_string), NULL, 0,
+ NI_NUMERICHOST) != 0) {
++#ifdef G_OS_WIN32
++ gchar *msg = g_win32_error_message (WSAGetLastError ());
++ nice_debug ("Error running getnameinfo: %s", msg);
++ g_free (msg);
++#endif
+ return NULL;
+ }
+
+--
+2.27.0.windows.1
+