File 0449-Support-local-sockets-with-inet-i-0.patch of Package erlang

From 9adc5cb879b1e939711a83fa7db3928310fbec06 Mon Sep 17 00:00:00 2001
From: Frank Hunleth <fhunleth@troodon-software.com>
Date: Sat, 22 Jun 2019 16:41:31 -0400
Subject: [PATCH] Support local sockets with inet:i/0

Before:

1> gen_udp:open(0, [local, {ip, {local, "unixdomainfile"}}]).
{ok,#Port<0.6>}
2> inet:i().
** exception error: bad argument
     in function  integer_to_list/1
        called as integer_to_list(<<"unixdomainfile">>)
     in call from inet:fmt_port/2 (inet.erl, line 1646)
     in call from inet:fmt_addr/2 (inet.erl, line 1642)
     in call from inet:'-i_line/3-lc$^0/1-0-'/3 (inet.erl, line 1547)
     in call from inet:'-i_line/3-lc$^0/1-0-'/3 (inet.erl, line 1547)
     in call from inet:'-info_lines/3-lc$^0/1-0-'/3 (inet.erl, line 1546)
     in call from inet:ii/3 (inet.erl, line 1531)
     in call from inet:i/0 (inet.erl, line 1515)

After:

Port Module    Recv Sent Owner      Local Address           Foreign Address State Type
4160 local_udp 0    0    <0.1747.0> local:unixdomainfile    *:*             IDLE  DGRAM
---
 lib/kernel/src/inet.erl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 7940903658..24aff83fbd 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -1645,6 +1645,7 @@ fmt_addr({ok,Addr}, Proto) ->
 	{{0,0,0,0,0,0,0,0},Port} -> "*:" ++ fmt_port(Port, Proto);
 	{{127,0,0,1},Port} -> "localhost:" ++ fmt_port(Port, Proto);
 	{{0,0,0,0,0,0,0,1},Port} -> "localhost:" ++ fmt_port(Port, Proto);
+	{local, Path} -> "local:" ++ binary_to_list(Path);
 	{IP,Port} -> inet_parse:ntoa(IP) ++ ":" ++ fmt_port(Port, Proto)
     end.
 
-- 
2.16.4

openSUSE Build Service is sponsored by