diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2013-04-09 02:48:03 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2013-04-09 02:48:03 +0000 |
commit | c2ced4a2aba6bdde3fdad77407cd528e8a11a446 (patch) | |
tree | 76fee7f6f6a7e18bbec88064f1f36de465c1f667 /epan | |
parent | cfd03173b443f9c8644aa7196105f7eb166926a7 (diff) | |
download | wireshark-c2ced4a2aba6bdde3fdad77407cd528e8a11a446.tar.gz |
Don't try to open <home>/.wireshark on Windows: Wireshark hasn't written to
that directory since 2001 and reading from that directory was only left in for
backwards compatibility with versions prior to r4702. I think it's now safe
to remove that backwards compatibility.
This eliminates the last argument of get_persconffile_path().
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8437
svn path=/trunk/; revision=48797
Diffstat (limited to 'epan')
-rw-r--r-- | epan/addr_resolv.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-radius.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-xml.c | 2 | ||||
-rw-r--r-- | epan/filesystem.c | 33 | ||||
-rw-r--r-- | epan/filesystem.h | 9 | ||||
-rw-r--r-- | epan/oids.c | 10 | ||||
-rw-r--r-- | epan/prefs.c | 4 | ||||
-rw-r--r-- | epan/uat.c | 2 | ||||
-rw-r--r-- | epan/wslua/init_wslua.c | 4 | ||||
-rw-r--r-- | epan/wslua/wslua_util.c | 4 |
10 files changed, 22 insertions, 58 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index c75b6f0ea3..f27c73cd85 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -582,7 +582,7 @@ initialize_services(void) /* set personal services path */ if (g_pservices_path == NULL) - g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE, FALSE); + g_pservices_path = get_persconffile_path(ENAME_SERVICES, FALSE); parse_services_file(g_pservices_path); @@ -1483,7 +1483,7 @@ initialize_ethers(void) * with it. It's used in get_ethbyname() and get_ethbyaddr() */ if (g_pethers_path == NULL) - g_pethers_path = get_persconffile_path(ENAME_ETHERS, FALSE, FALSE); + g_pethers_path = get_persconffile_path(ENAME_ETHERS, FALSE); /* manuf hash table initialization */ @@ -1893,7 +1893,7 @@ initialize_ipxnets(void) * with it. It's used in get_ipxnetbyname() and get_ipxnetbyaddr() */ if (g_pipxnets_path == NULL) - g_pipxnets_path = get_persconffile_path(ENAME_IPXNETS, FALSE, FALSE); + g_pipxnets_path = get_persconffile_path(ENAME_IPXNETS, FALSE); ipxnet_resolution_initialized = TRUE; } /* initialize_ipxnets */ @@ -2369,7 +2369,7 @@ subnet_name_lookup_init(void) subnet_length_entries[i].mask = get_subnet_mask(length); } - subnetspath = get_persconffile_path(ENAME_SUBNETS, FALSE, FALSE); + subnetspath = get_persconffile_path(ENAME_SUBNETS, FALSE); if (!read_subnets_file(subnetspath) && errno != ENOENT) { report_open_failure(subnetspath, errno, FALSE); } @@ -2473,7 +2473,7 @@ host_name_lookup_init(void) { * Load the user's hosts file, if they have one. */ if(!gbl_resolv_flags.load_hosts_file_from_profile_only){ - hostspath = get_persconffile_path(ENAME_HOSTS, TRUE, FALSE); + hostspath = get_persconffile_path(ENAME_HOSTS, TRUE); if (!read_hosts_file(hostspath) && errno != ENOENT) { report_open_failure(hostspath, errno, FALSE); } diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index 7e3502a279..d62601dcf7 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -1996,7 +1996,7 @@ static void register_radius_fields(const char* unused _U_) { g_array_append_vals(ri.hf, base_hf, array_length(base_hf)); g_array_append_vals(ri.ett, base_ett, array_length(base_ett)); - dir = get_persconffile_path("radius", FALSE, FALSE); + dir = get_persconffile_path("radius", FALSE); if (test_for_directory(dir) != EISDIR) { /* Although dir isn't a directory it may still use memory */ diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index 0a1ef30a52..313ccb5340 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -1283,7 +1283,7 @@ static void init_xml_names(void) xmlpi_xml_ns->elements = NULL; - dirname = get_persconffile_path("dtds", FALSE, FALSE); + dirname = get_persconffile_path("dtds", FALSE); if (test_for_directory(dirname) != EISDIR) { /* Although dir isn't a directory it may still use memory */ diff --git a/epan/filesystem.c b/epan/filesystem.c index afd1b06003..b68b4f4bc8 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -1462,17 +1462,9 @@ get_home_dir(void) * caller is done with it. */ char * -get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_writing -#ifndef _WIN32 - _U_ -#endif -) +get_persconffile_path(const char *filename, gboolean from_profile) { char *path; -#ifdef _WIN32 - ws_statb64 s_buf; - char *old_path; -#endif if (do_store_persconffiles && from_profile && !g_hash_table_lookup (profile_files, filename)) { /* Store filenames so we know which filenames belongs to a configuration profile */ g_hash_table_insert (profile_files, g_strdup(filename), g_strdup(filename)); @@ -1485,27 +1477,6 @@ get_persconffile_path(const char *filename, gboolean from_profile, gboolean for_ path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(NULL), filename); } -#ifdef _WIN32 - if (!for_writing) { - if (ws_stat64(path, &s_buf) != 0 && errno == ENOENT) { - /* - * OK, it's not in the personal configuration file - * directory; is it in the ".wireshark" subdirectory - * of their home directory? - */ - old_path = g_strdup_printf( - "%s" G_DIR_SEPARATOR_S ".wireshark" G_DIR_SEPARATOR_S "%s", - get_home_dir(), filename); - if (ws_stat64(old_path, &s_buf) == 0) { - /* - * OK, it exists; return it instead. - */ - g_free(path); - path = old_path; - } - } - } -#endif return path; } @@ -1587,7 +1558,7 @@ get_datafile_path(const char *filename) char * get_plugins_pers_dir(void) { - return get_persconffile_path(PLUGINS_DIR_NAME, FALSE, FALSE); + return get_persconffile_path(PLUGINS_DIR_NAME, FALSE); } /* Delete a file */ diff --git a/epan/filesystem.h b/epan/filesystem.h index a972712af4..6b76bab4fc 100644 --- a/epan/filesystem.h +++ b/epan/filesystem.h @@ -191,17 +191,10 @@ WS_DLL_PUBLIC int create_persconffile_dir(char **pf_dir_path_return); * file name. If using configuration profiles this directory will be * used if "from_profile" is TRUE. * - * On Win32, if "for_writing" is FALSE, we check whether the file exists - * and, if not, construct a path name relative to the ".wireshark" - * subdirectory of the user's home directory, and check whether that - * exists; if it does, we return that, so that configuration files - * from earlier versions can be read. - * * The returned file name was g_malloc()'d so it must be g_free()d when the * caller is done with it. */ -WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, gboolean from_profile, - gboolean for_writing); +WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, gboolean from_profile); /* * Get the (default) directory in which personal data is stored. diff --git a/epan/oids.c b/epan/oids.c index 2f7ca68ddc..183841a40d 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -802,15 +802,15 @@ void oid_pref_init(module_t *nameres) #else prefs_register_static_text_preference(nameres, "load_smi_modules_static", - "Enable OID resolution: N/A", + "Enable OID resolution: N/A", "Support for OID resolution was not compiled into this version of Wireshark"); prefs_register_static_text_preference(nameres, "suppress_smi_errors_static", - "Suppress SMI errors: N/A", + "Suppress SMI errors: N/A", "Support for OID resolution was not compiled into this version of Wireshark"); prefs_register_static_text_preference(nameres, "smi_module_path", - "SMI (MIB and PIB) modules and paths: N/A", + "SMI (MIB and PIB) modules and paths: N/A", "Support for OID resolution was not compiled into this version of Wireshark"); #endif } @@ -1173,7 +1173,7 @@ oid_get_default_mib_path(void) { guint i; path_str = g_string_new(""); - + if (!load_smi_modules) { D(1,("OID resolution not enabled")); return path_str->str; @@ -1184,7 +1184,7 @@ oid_get_default_mib_path(void) { g_string_append_printf(path_str, "%s;", path); g_free (path); - path = get_persconffile_path("snmp\\mibs", FALSE, FALSE); + path = get_persconffile_path("snmp\\mibs", FALSE); g_string_append_printf(path_str, "%s", path); g_free (path); #else diff --git a/epan/prefs.c b/epan/prefs.c index 367dad0622..3cf09eeb0a 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2936,7 +2936,7 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return, } /* Construct the pathname of the user's preferences file. */ - pf_path = get_persconffile_path(PF_NAME, TRUE, FALSE); + pf_path = get_persconffile_path(PF_NAME, TRUE); /* Read the user's preferences file, if it exists. */ *pf_path_return = NULL; @@ -4439,7 +4439,7 @@ write_prefs(char **pf_path_return) */ if (pf_path_return != NULL) { - pf_path = get_persconffile_path(PF_NAME, TRUE, TRUE); + pf_path = get_persconffile_path(PF_NAME, TRUE); if ((pf = ws_fopen(pf_path, "w")) == NULL) { *pf_path_return = pf_path; return errno; diff --git a/epan/uat.c b/epan/uat.c index 2f05fb621f..f1abbb6ccb 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -168,7 +168,7 @@ gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing) { gchar *pers_fname = NULL; if (! uat->from_global) { - pers_fname = get_persconffile_path(uat->filename, uat->from_profile, for_writing); + pers_fname = get_persconffile_path(uat->filename, uat->from_profile); } if ((! for_writing ) && (! file_exists(pers_fname) )) { diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c index 286d91bfe5..ad23c1ecb0 100644 --- a/epan/wslua/init_wslua.c +++ b/epan/wslua/init_wslua.c @@ -337,7 +337,7 @@ int wslua_init(register_cb cb, gpointer client_data) { G_LOG_LEVEL_MESSAGE| G_LOG_LEVEL_INFO| G_LOG_LEVEL_DEBUG), - ops ? ops->logger : basic_logger, + ops ? ops->logger : basic_logger, NULL); if (!L) { @@ -396,7 +396,7 @@ int wslua_init(register_cb cb, gpointer client_data) { /* if we are indeed superuser run user scripts only if told to do so */ if ( (!started_with_special_privs()) || run_anyway ) { - filename = get_persconffile_path("init.lua", FALSE, FALSE); + filename = get_persconffile_path("init.lua", FALSE); if ((file_exists(filename))) { lua_load_script(filename); diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c index 575277b5e7..073dea08b4 100644 --- a/epan/wslua/wslua_util.c +++ b/epan/wslua/wslua_util.c @@ -189,7 +189,7 @@ static char* wslua_get_actual_filename(const char* fname) { return g_strdup(fname_clean); } - filename = get_persconffile_path(fname_clean,FALSE,FALSE); + filename = get_persconffile_path(fname_clean,FALSE); if ( file_exists(filename) ) { return filename; @@ -252,7 +252,7 @@ WSLUA_FUNCTION wslua_dofile(lua_State* L) { WSLUA_FUNCTION wslua_persconffile_path(lua_State* L) { #define WSLUA_OPTARG_persconffile_path_FILENAME 1 /* A filename */ const char *fname = luaL_optstring(L, WSLUA_OPTARG_persconffile_path_FILENAME,""); - char* filename = get_persconffile_path(fname,FALSE,FALSE); + char* filename = get_persconffile_path(fname,FALSE); lua_pushstring(L,filename); g_free(filename); |