File 2842-ssh-Let-ssh_agent_SUITE-check-for-Unix-Domain-Socket.patch of Package erlang

From c40ead9604105fffb46ded3212200d3e7d5e3ae0 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Mon, 9 Mar 2020 10:00:48 +0100
Subject: [PATCH 02/12] ssh: Let ssh_agent_SUITE check for Unix Domain Socket
 support

---
 lib/ssh/test/ssh_agent_SUITE.erl | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/ssh/test/ssh_agent_SUITE.erl b/lib/ssh/test/ssh_agent_SUITE.erl
index f7ac016844..44616fb969 100644
--- a/lib/ssh/test/ssh_agent_SUITE.erl
+++ b/lib/ssh/test/ssh_agent_SUITE.erl
@@ -41,7 +41,7 @@ init_per_suite(Config) ->
     ?CHECK_CRYPTO(
        begin
            ok = ssh:start(),
-           ssh_agent_mock_server:check_mktemp(Config)
+           chk_unix_domain_socket(Config)
        end
       ).
 
@@ -132,3 +132,23 @@ connect_with_ssh_agent(Config) ->
     ssh:close(ConnectionRef),
     ssh:stop_daemon(Pid),
     ssh_agent_mock_server:stop(SocketPath).
+
+
+%%%================================================================
+chk_unix_domain_socket(Config0) ->
+    case ssh_agent_mock_server:check_mktemp(Config0) of
+        {skip, Msg} ->
+            {skip, Msg};
+
+        Config ->
+            SocketPath = string:chomp(os:cmd("mktemp -u")),
+            case gen_tcp:listen(0, [local,  {ip, {local,SocketPath}}]) of
+                {error,eafnosupport} ->
+                    file:delete(SocketPath),
+                    {skip, "Unix Domain Sockets are not supported"};
+                {ok, Socket} ->
+                    gen_tcp:close(Socket),
+                    file:delete(SocketPath),
+                    Config
+            end
+    end.
-- 
2.16.4

openSUSE Build Service is sponsored by