summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2007-08-28 19:07:39 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2007-08-28 19:07:39 +0000
commit450767fb930e30c29edf521b24ac315cdbe02aa4 (patch)
tree66727d7eb1a9644e234535aa703b004b94bca3e0
parentc16bfc05ab2d9ef857763d1c928d9140769b5763 (diff)
downloadwireshark-450767fb930e30c29edf521b24ac315cdbe02aa4.tar.gz
Report loading failures to the user
svn path=/trunk/; revision=22712
-rw-r--r--epan/oids.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/epan/oids.c b/epan/oids.c
index 7e3de7fccd..8e90813321 100644
--- a/epan/oids.c
+++ b/epan/oids.c
@@ -191,8 +191,19 @@ static smi_module_t* smi_modules = NULL;
static guint num_smi_modules = 0;
static uat_t* smi_modules_uat = NULL;
+static GString* smi_errors;
+
UAT_CSTRING_CB_DEF(smi_mod,name,smi_module_t)
+static void smi_error_handler(char *path, int line, int severity, char *msg, char *tag) {
+ g_string_sprintfa(smi_errors,"%s:%d %d %s %s\n",
+ path ? path : "-",
+ line, severity,
+ tag ? tag : "-",
+ msg ? msg : "");
+}
+
+
static void* smi_mod_copy_cb(void* dest, const void* orig, unsigned len _U_) {
const smi_module_t* m = orig;
smi_module_t* d = dest;
@@ -522,8 +533,11 @@ void register_mibs(void) {
smiSetPath(path_str->str);
- g_string_free(path_str,TRUE);
+
+ smi_errors = g_string_new("");
+ smiSetErrorHandler(smi_error_handler);
+
for(i=0;i<num_smi_modules;i++) {
if (!smi_modules[i].name) continue;
@@ -538,7 +552,16 @@ void register_mibs(void) {
D(1,("Failed to load: '%s'[%d]",smi_modules[i].name,i));
}
}
-
+
+ if (smi_errors->len) {
+ report_failure("The following errors were found while loading the MIBS:\n%s\n\n"
+ "The Current Path is: %s\n" , smi_errors->str , path_str->str );
+ D(1,("Errors while loading:\n%s\n",smi_errors->str));
+ }
+
+ g_string_free(path_str,TRUE);
+ g_string_free(smi_errors,TRUE);
+
for (smiModule = smiGetFirstModule();
smiModule;
smiModule = smiGetNextModule(smiModule)) {