diff options
author | Lars Thorsen <[email protected]> | 2016-07-07 14:58:37 +0200 |
---|---|---|
committer | Lars Thorsen <[email protected]> | 2016-09-07 14:03:05 +0200 |
commit | cda114d8186af91f4fa18c5e549c85ffa3b5ea55 (patch) | |
tree | bd596511bd2d96e211ffd2d2a1cdf71920a6c125 /lib/snmp/src/compile/snmpc_misc.erl | |
parent | 504b99b3dff501f8b4acd1c153f758723e66c2e2 (diff) | |
download | otp-cda114d8186af91f4fa18c5e549c85ffa3b5ea55.tar.gz otp-cda114d8186af91f4fa18c5e549c85ffa3b5ea55.tar.bz2 otp-cda114d8186af91f4fa18c5e549c85ffa3b5ea55.zip |
[snmp] Correct bug when path to mib contains UTF-8 characters
Diffstat (limited to 'lib/snmp/src/compile/snmpc_misc.erl')
-rw-r--r-- | lib/snmp/src/compile/snmpc_misc.erl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/snmp/src/compile/snmpc_misc.erl b/lib/snmp/src/compile/snmpc_misc.erl index 933d629746..312074f2e7 100644 --- a/lib/snmp/src/compile/snmpc_misc.erl +++ b/lib/snmp/src/compile/snmpc_misc.erl @@ -29,7 +29,7 @@ bits_to_int/2, ensure_trailing_dir_delimiter/1, foreach/3, - is_string/1, + check_file/1, read_mib/1, read_noexit/2, strip_extension_from_filename/2, @@ -86,21 +86,21 @@ to_upper([C|Cs]) -> [C|to_upper(Cs)]; to_upper([]) -> []. -is_string([]) -> true; -is_string([Tkn | Str]) - when is_integer(Tkn) andalso (Tkn >= 0) andalso (Tkn =< 255) -> - is_string(Str); -is_string(_) -> false. - - +check_file(FileName) -> + case filename:extension(FileName) of + ".mib" -> + filelib:is_regular(FileName); + _ -> + filelib:is_regular(FileName ++ ".mib") + end. + + foreach(Function, ExtraArgs, [H | T]) -> apply(Function, [H | ExtraArgs]), foreach(Function, ExtraArgs, T); foreach(_Function, _ExtraArgs, []) -> true. - - %%---------------------------------------------------------------------- %% Returns: {ok, Mib}|{error, Reason} %% The reason for having the function if this module is: |