From 57abd27ee8e189791c4d97ef86de6136c4924b52 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 31 Oct 2013 17:03:02 +0100 Subject: [snmp] Improving ATL handling of corrupt logs When converting an Audit Trail Log to text a corrupt log entry could cause the entire conversion to fail. Also, for a log with sequence numbers, failing to decode a log entry would cause the conversion to fail (not because of the failed decode, but because of the failure to write the error message). OTP-11453 --- lib/snmp/src/misc/snmp_verbosity.erl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/snmp/src/misc/snmp_verbosity.erl') diff --git a/lib/snmp/src/misc/snmp_verbosity.erl b/lib/snmp/src/misc/snmp_verbosity.erl index df5986b7bc..8c4fe3fcb0 100644 --- a/lib/snmp/src/misc/snmp_verbosity.erl +++ b/lib/snmp/src/misc/snmp_verbosity.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2012. All Rights Reserved. +%% Copyright Ericsson AB 2000-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -152,7 +152,17 @@ image_of_sname(mgr) -> "MGR"; image_of_sname(mgr_misc) -> "MGR_MISC"; image_of_sname(undefined) -> ""; -image_of_sname(V) -> lists:flatten(io_lib:format("~p",[V])). +image_of_sname(S) when is_list(S) -> + %% The assumption is that its a printable string, + %% but just in case it is some other list... + try lists:flatten(io_lib:format("~s", [S])) of + L -> + L + catch + _:_ -> + lists:flatten(io_lib:format("~p", [S])) + end; +image_of_sname(V) -> lists:flatten(io_lib:format("~p", [V])). validate(info) -> info; -- cgit v1.2.3