diff options
author | Micael Karlberg <[email protected]> | 2012-02-27 16:09:38 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-02-27 16:09:38 +0100 |
commit | a05886528ce9a02a79eda82c8868f489dd478aaa (patch) | |
tree | a8060cb88342da0816c54a40cd3d7c1b6f516661 /lib/snmp/src/misc | |
parent | f6b7aade87b64c4c60eba65dfac6310a8c7bf139 (diff) | |
parent | d11e013575ed400b7167342be4b08ba3d1166ee9 (diff) | |
download | otp-a05886528ce9a02a79eda82c8868f489dd478aaa.tar.gz otp-a05886528ce9a02a79eda82c8868f489dd478aaa.tar.bz2 otp-a05886528ce9a02a79eda82c8868f489dd478aaa.zip |
Merge branch 'bmk/snmp/improve_error_handling_reading_config/OTP-9943' into bmk/snmp/snmp422_integration/r15
Conflicts:
lib/snmp/doc/src/notes.xml
lib/snmp/src/app/snmp.appup.src
Diffstat (limited to 'lib/snmp/src/misc')
-rw-r--r-- | lib/snmp/src/misc/snmp_conf.erl | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl index 7249def24e..e1e7fab57b 100644 --- a/lib/snmp/src/misc/snmp_conf.erl +++ b/lib/snmp/src/misc/snmp_conf.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2012. 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 @@ -71,6 +71,18 @@ %%----------------------------------------------------------------- +%% read_files(Dir, Files) -> Configs +%% Dir - string() - Full path to the config dir. +%% Files - [{Gen, Filter, Check, FileName}] +%% Gen - function/2 - In case of failure when reading the config file, +%% this function is called to either generate a +%% default file or issue the error. +%% Filter - function/1 - Filters all the config entries read from the file +%% Check - function/1 - Check each entry as they are read from the file. +%% FileName - string() - Name of the config file. +%% Configs - [config_entry()] +%% config_entry() - term() + read_files(Dir, Files) when is_list(Dir) andalso is_list(Files) -> read_files(Dir, Files, []). @@ -90,7 +102,7 @@ read_files(Dir, [{Gen, Filter, Check, FileName}|Files], Res) {error, R} -> ?vlog("failed reading file info for ~s: " "~n ~p", [FileName, R]), - Gen(Dir), + Gen(Dir, R), read_files(Dir, Files, [Filter([])|Res]) end. @@ -99,6 +111,7 @@ read_files(Dir, [{Gen, Filter, Check, FileName}|Files], Res) read(File, Check) when is_function(Check) -> ?vdebug("read -> entry with" "~n File: ~p", [File]), + Fd = open_file(File), case loop(Fd, [], Check, 1, File) of |