Make jlib:ip_to_list safe to use

This commit is contained in:
Alexey Shchepin 2010-12-20 17:56:24 +02:00 committed by Badlop
parent 7ca1c0387c
commit bb4a87806f
1 changed files with 3 additions and 1 deletions

View File

@ -392,7 +392,9 @@ e(X) -> exit({bad_encode_base64_token, X}).
ip_to_list({IP, _Port}) ->
ip_to_list(IP);
ip_to_list(IpTuple) when is_tuple(IpTuple) ->
inet_parse:ntoa(IpTuple).
inet_parse:ntoa(IpTuple);
ip_to_list(IP) ->
lists:flatten(io_lib:format("~w", [IP])).
% --------------------------------------------------------------------
% Compat layer.