aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/socket-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/socket-helpers.c')
-rw-r--r--tests/unit/socket-helpers.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c
index 5af4de5..eecadf3 100644
--- a/tests/unit/socket-helpers.c
+++ b/tests/unit/socket-helpers.c
@@ -154,3 +154,19 @@ int socket_check_protocol_support(bool *has_ipv4, bool *has_ipv6)
return 0;
}
+
+void socket_check_afunix_support(bool *has_afunix)
+{
+ int fd;
+
+ fd = socket(PF_UNIX, SOCK_STREAM, 0);
+ closesocket(fd);
+
+#ifdef _WIN32
+ *has_afunix = (fd != (int)INVALID_SOCKET);
+#else
+ *has_afunix = (fd >= 0);
+#endif
+
+ return;
+}