diff options
Diffstat (limited to 'mergecap.c')
-rw-r--r-- | mergecap.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/mergecap.c b/mergecap.c index f3cf9224e8..fd2c2838c3 100644 --- a/mergecap.c +++ b/mergecap.c @@ -242,6 +242,7 @@ main(int argc, char *argv[]) { GString *comp_info_str; GString *runtime_info_str; + char *init_progfile_dir_error; int opt; static const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, @@ -266,10 +267,6 @@ main(int argc, char *argv[]) gboolean use_stdout = FALSE; merge_progress_callback_t cb; -#ifdef HAVE_PLUGINS - char *init_progfile_dir_error; -#endif - cmdarg_err_init(mergecap_cmdarg_err, mergecap_cmdarg_err_cont); #ifdef _WIN32 @@ -298,27 +295,33 @@ main(int argc, char *argv[]) */ init_process_policies(); + /* + * Attempt to get the pathname of the directory containing the + * executable file. + */ + init_progfile_dir_error = init_progfile_dir(argv[0], main); + if (init_progfile_dir_error != NULL) { + fprintf(stderr, + "mergecap: Can't get pathname of directory containing the mergecap program: %s.\n", + init_progfile_dir_error); + g_free(init_progfile_dir_error); + } + wtap_init(); #ifdef HAVE_PLUGINS - /* Register wiretap plugins */ - if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) { - g_warning("mergecap: init_progfile_dir(): %s", init_progfile_dir_error); - g_free(init_progfile_dir_error); - } else { - init_report_err(failure_message,NULL,NULL,NULL); + init_report_err(failure_message,NULL,NULL,NULL); - /* Scan for plugins. This does *not* call their registration routines; - that's done later. + /* Scan for plugins. This does *not* call their registration routines; + that's done later. - Don't report failures to load plugins because most (non-wiretap) - plugins *should* fail to load (because we're not linked against - libwireshark and dissector plugins need libwireshark).*/ - scan_plugins(DONT_REPORT_LOAD_FAILURE); + Don't report failures to load plugins because most (non-wiretap) + plugins *should* fail to load (because we're not linked against + libwireshark and dissector plugins need libwireshark).*/ + scan_plugins(DONT_REPORT_LOAD_FAILURE); - /* Register all libwiretap plugin modules. */ - register_all_wiretap_modules(); - } + /* Register all libwiretap plugin modules. */ + register_all_wiretap_modules(); #endif /* Process the options first */ |