From 8de5ac7737bd6f121af35ca60e22f0696bbdc06b Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 3 Feb 2010 15:23:12 +0100 Subject: inet_res: /etc/resolv.conf: use domain as default search list When the search list option in /etc/resolv.conf was empty, the domain option was not used as default search domain. That has been fixed in this patch. --- lib/kernel/src/inet_db.erl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/kernel/src') diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl index 9cdffb5f2c..00c3a6af9c 100644 --- a/lib/kernel/src/inet_db.erl +++ b/lib/kernel/src/inet_db.erl @@ -1011,13 +1011,22 @@ handle_call(Request, From, #state{db=Db}=State) -> case inet_parse:resolv( Fname, {chars,Bin}) of {ok,Opts} -> + Search = + lists:foldl( + fun ({search,L}, _) -> + L; + ({domain,""}, S) -> + S; + ({domain,D}, _) -> + [D]; + (_, S) -> + S + end, [], Opts), [del_ns, clear_search, - clear_cache - |[Opt || - {T,_}=Opt <- Opts, - (T =:= nameserver orelse - T =:= search)]]; + clear_cache, + {search,Search} + |[Opt || {nameserver,_}=Opt <- Opts]]; _ -> error end end, -- cgit v1.2.3