diff options
author | Micael Karlberg <[email protected]> | 2013-10-31 17:03:02 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2013-10-31 17:03:02 +0100 |
commit | 57abd27ee8e189791c4d97ef86de6136c4924b52 (patch) | |
tree | feb1d9108627b3055ae93dadb02dcefcd46319ba /lib/snmp/src/misc/snmp_verbosity.erl | |
parent | 98412eababc3f81719e9c150c9cff6c629e2a3ff (diff) | |
download | otp-57abd27ee8e189791c4d97ef86de6136c4924b52.tar.gz otp-57abd27ee8e189791c4d97ef86de6136c4924b52.tar.bz2 otp-57abd27ee8e189791c4d97ef86de6136c4924b52.zip |
[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
Diffstat (limited to 'lib/snmp/src/misc/snmp_verbosity.erl')
-rw-r--r-- | lib/snmp/src/misc/snmp_verbosity.erl | 14 |
1 files changed, 12 insertions, 2 deletions
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; |