File 0301-Pass-empty-hostname-through-to-backend.patch of Package erlang

From 5edd080f438f62d08a38660636fc158c52164e46 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Tue, 4 Apr 2023 16:28:07 +0200
Subject: [PATCH 2/4] Pass empty hostname through to backend

---
 lib/kernel/src/inet.erl     |  4 ++--
 lib/kernel/src/inet_res.erl | 11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index 55114ab7f9..d836f6b367 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -1,7 +1,7 @@
 %%
 %% %CopyrightBegin%
 %%
-%% Copyright Ericsson AB 1997-2023. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2022. All Rights Reserved.
 %%
 %% Licensed under the Apache License, Version 2.0 (the "License");
 %% you may not use this file except in compliance with the License.
@@ -1513,7 +1513,7 @@ getaddrs_tm({A,B,C,D,E,F,G,H} = IP, Fam, _) ->
 getaddrs_tm(Address, Family, Timer) when is_atom(Address) ->
     getaddrs_tm(atom_to_list(Address), Family, Timer);
 getaddrs_tm(Address, Family, Timer) ->
-    case inet_parse:visible_string(Address) andalso Address =/= "" of
+    case inet_parse:visible_string(Address) of
 	false ->
 	    {error,einval};
 	true ->
diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl
index 4e0888c62e..745144f58c 100644
--- a/lib/kernel/src/inet_res.erl
+++ b/lib/kernel/src/inet_res.erl
@@ -490,7 +490,7 @@ getbyname(Name, Type, Timeout) ->
 getbyname_tm(Name, Type, Timer) when is_list(Name) ->
     case type_p(Type) of
 	true ->
-	    case inet_parse:visible_string(Name) andalso Name =/= "" of
+	    case inet_parse:visible_string(Name) of
 		false ->
                     {error, formerr};
 		true ->
@@ -573,12 +573,13 @@ res_getby_search(Name, [Dom | Ds], _Reason, Type, Timer) ->
     QueryName =
         %% Join Name and Dom with a single dot.
         %% Allow Dom to be "." or "", but not to lead with ".".
-        %% Do not allow Name to be "".
         if
-            Name =/= "" andalso (Dom =:= "." orelse Dom =:= "") ->
+            Dom =:= "."; Dom =:= "" ->
                 Name;
-            Name =/= "" andalso hd(Dom) =/= $. ->
-                Name++"."++Dom;
+            Name =/= "", hd(Dom) =/= $. ->
+                Name ++ "." ++ Dom;
+            Name =:= "", hd(Dom) =/= $. ->
+                Dom;
             true ->
                 erlang:error({if_clause, Name, Dom})
         end,
-- 
2.35.3

openSUSE Build Service is sponsored by