Don't try to open <home>/.wireshark on Windows: Wireshark hasn't written to
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 9 Apr 2013 02:48:03 +0000 (02:48 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 9 Apr 2013 02:48:03 +0000 (02:48 +0000)
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

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@48797 f5534014-38df-0310-8fa8-9805f1628bb7

19 files changed:
color_filters.c
disabled_protos.c
epan/addr_resolv.c
epan/dissectors/packet-radius.c
epan/dissectors/packet-xml.c
epan/filesystem.c
epan/filesystem.h
epan/oids.c
epan/prefs.c
epan/uat.c
epan/wslua/init_wslua.c
epan/wslua/wslua_util.c
filters.c
ui/gtk/about_dlg.c
ui/gtk/decode_as_dlg.c
ui/gtk/main.c
ui/qt/main.cpp
ui/recent.c
update.c

index 3ee290b7de13776f640024cd2cba40e26596c2ba..b960be5b38564b35f0960c3beccb23d306422b0c 100644 (file)
@@ -628,7 +628,7 @@ read_users_filters(GSList **cfl)
     gboolean  ret;
 
     /* decide what file to open (from dfilter code) */
-    path = get_persconffile_path("colorfilters", TRUE, FALSE);
+    path = get_persconffile_path("colorfilters", TRUE);
     if ((f = ws_fopen(path, "r")) == NULL) {
         if (errno != ENOENT) {
             simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
@@ -753,7 +753,7 @@ color_filters_write(GSList *cfl)
         return FALSE;
     }
 
-    path = get_persconffile_path("colorfilters", TRUE, TRUE);
+    path = get_persconffile_path("colorfilters", TRUE);
     if ((f = ws_fopen(path, "w+")) == NULL) {
         simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                       "Could not open\n%s\nfor writing: %s.",
index b85f1ed770e83965323438bd3ff8d0bf4e2bd6ee..56b26226927c11d806fd6d510bb292f999322dbd 100644 (file)
@@ -128,7 +128,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return,
   }
 
   /* Construct the pathname of the user's disabled protocols file. */
-  ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE, FALSE);
+  ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE);
 
   /* If we already have a list of protocols, discard it. */
   discard_existing_list (&disabled_protos);
@@ -336,7 +336,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
 
   *pref_path_return = NULL;    /* assume no error */
 
-  ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE, TRUE);
+  ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE);
 
   /* Write to "XXX.new", and rename if that succeeds.
      That means we don't trash the file if we fail to write it out
index c75b6f0ea3704cbda306977b1f73301c57c75573..f27c73cd855f82dbc1c54ea9be7adf2ee4d1a7d2 100644 (file)
@@ -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);
     }
index 7e3502a27918d403441e46a3c159f5f0b939940d..d62601dcf7fdc7de09e13fa1fc2d8bb78a365a1b 100644 (file)
@@ -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 */
index 0a1ef30a5220d44530edc4e9e770139388fe23f3..313ccb5340372972362c1f3688abd73d8af9916d 100644 (file)
@@ -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 */
index afd1b06003ac2c6db973bc76ef3b5aef05d58a7b..b68b4f4bc87dbdd2b14bf597c460d92b4c5f0da8 100644 (file)
@@ -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 */
index a972712af466649c6af39f6b4d6a2882e7331a3d..6b76bab4fc59a2ba8c91af0ae3246a64170e9d82 100644 (file)
@@ -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.
index 2f7ca68ddc0daf03b610f723b19bce11e6b40add..183841a40d5e1d7150ed7f9aca34c039b8c22284 100644 (file)
@@ -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
index 367dad0622e3a994acc15c2eafe65d01efa5f200..3cf09eeb0a7f01f01508b0527b87858ebb6108f1 100644 (file)
@@ -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;
index 2f05fb621f89854ea0acc025c24a8a661cb52f2e..f1abbb6ccbb676db1c2d8b64318938143ce7d2ce 100644 (file)
@@ -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) )) {
index 286d91bfe5e8674bb7b4378e76900b5869a941d4..ad23c1ecb0eb194825a87541d779ca2d92428ca5 100644 (file)
@@ -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);
index 575277b5e7b5d697031eca26cd873564b9d99477..073dea08b44d0a8210aff6325c855a8f4cf00b67 100644 (file)
@@ -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);
index 8ec3bdcd7584d4d6f9257daa5ff7f18bc5200b04..5fb5ac4991a51d5872bc87a7638ee63bb557ff1e 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -143,7 +143,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
   }
 
   /* try to open personal "cfilters"/"dfilters" file */
-  ff_path = get_persconffile_path(ff_name, TRUE, FALSE);
+  ff_path = get_persconffile_path(ff_name, TRUE);
   if ((ff = ws_fopen(ff_path, "r")) == NULL) {
     /*
      * Did that fail because the file didn't exist?
@@ -166,7 +166,7 @@ read_filter_list(filter_list_type_t list_type, char **pref_path_return,
      * a particular list.
      */
     g_free(ff_path);
-    ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE, FALSE);
+    ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE);
     if ((ff = ws_fopen(ff_path, "r")) == NULL) {
       /*
        * Did that fail because the file didn't exist?
@@ -488,7 +488,7 @@ save_filter_list(filter_list_type_t list_type, char **pref_path_return,
     return;
   }
 
-  ff_path = get_persconffile_path(ff_name, TRUE, TRUE);
+  ff_path = get_persconffile_path(ff_name, TRUE);
 
   /* Write to "XXX.new", and rename if that succeeds.
      That means we don't trash the file if we fail to write it out
index 71aa50f116e69394d2f66101a57d2faa5a9d271e..3a0dbdfdc37de182d81c2a4c89379a475d35156f 100644 (file)
@@ -420,7 +420,7 @@ about_folders_page_new(void)
   g_free(path);
 
   /* pers conf */
-  path = get_persconffile_path("", FALSE, FALSE);
+  path = get_persconffile_path("", FALSE);
   about_folders_row(table, "Personal configuration", path,
       "\"dfilters\", \"preferences\", \"ethers\", ...");
   g_free(path);
index 6750a9c60c4e069bde5397bd040ec0b523e38632..e772099bb92be555b61bb138f45e4cab327bbcde 100644 (file)
@@ -686,7 +686,7 @@ decode_show_save_cb (GtkWidget *win _U_, gpointer user_data _U_)
      return;
   }
 
-  daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE, TRUE);
+  daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
   if ((daf = ws_fopen(daf_path, "w")) == NULL) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't open decode_as_entries file\n\"%s\": %s.", daf_path,
@@ -2221,7 +2221,7 @@ void load_decode_as_entries(void)
     decode_clear_all(FALSE);
   }
 
-  daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE, FALSE);
+  daf_path = get_persconffile_path(DECODE_AS_ENTRIES_FILE_NAME, TRUE);
   if ((daf = ws_fopen(daf_path, "r")) != NULL) {
     read_prefs_file(daf_path, daf, read_set_decode_as_entries, NULL);
     fclose(daf);
index 3bab40df69e40b57543a01772e342a3a0ed6658b..4467c52d29d06e25b1c4694084849655b1238336 100644 (file)
@@ -2944,7 +2944,7 @@ main(int argc, char *argv[])
 #else
   gtk_rc_parse(rc_file);
   g_free(rc_file);
-  rc_file = get_persconffile_path(RC_FILE, FALSE, FALSE);
+  rc_file = get_persconffile_path(RC_FILE, FALSE);
   gtk_rc_parse(rc_file);
 #endif
   g_free(rc_file);
index eddb9ebf93eef831182da819ad2d535430d58b46..6197bc89c1e072e617338548822c59c7dbf978eb 100644 (file)
@@ -1006,7 +1006,7 @@ int main(int argc, char *argv[])
 //  #else
 //    gtk_rc_parse(rc_file);
 //    g_free(rc_file);
-//    rc_file = get_persconffile_path(RC_FILE, FALSE, FALSE);
+//    rc_file = get_persconffile_path(RC_FILE, FALSE);
 //    gtk_rc_parse(rc_file);
 //  #endif
 //    g_free(rc_file);
index 6772565b423bb44856e11f8b71c26bba51695fb6..db1881e58505f3cc9be59066836e3e63669d08f2 100644 (file)
@@ -310,7 +310,7 @@ write_recent(void)
      return FALSE;
   }
 
-  rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, TRUE);
+  rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
   if ((rf = ws_fopen(rf_path, "w")) == NULL) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't open recent file\n\"%s\": %s.", rf_path,
@@ -433,7 +433,7 @@ write_profile_recent(void)
      return FALSE;
   }
 
-  rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, TRUE);
+  rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE);
   if ((rf = ws_fopen(rf_path, "w")) == NULL) {
      simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
       "Can't open recent file\n\"%s\": %s.", rf_path,
@@ -952,7 +952,7 @@ recent_read_static(char **rf_path_return, int *rf_errno_return)
   recent.gui_fileopen_remembered_dir = NULL;
 
   /* Construct the pathname of the user's recent common file. */
-  rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
+  rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
 
   /* Read the user's recent common file, if it exists. */
   *rf_path_return = NULL;
@@ -1017,7 +1017,7 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
   }
 
   /* Construct the pathname of the user's profile recent file. */
-  rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE, FALSE);
+  rf_path = get_persconffile_path(RECENT_FILE_NAME, TRUE);
 
   /* Read the user's recent file, if it exists. */
   *rf_path_return = NULL;
@@ -1034,7 +1034,7 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return)
      *  know what's supposed to happen at this point.
      *  ToDo: Determine if the "recent common file" should be read at this point
      */
-    rf_common_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
+    rf_common_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
     if (!file_exists(rf_common_path)) {
       /* Read older common settings from recent file */
       rf = ws_fopen(rf_path, "r");
@@ -1064,11 +1064,11 @@ recent_read_dynamic(char **rf_path_return, int *rf_errno_return)
 
 
   /* Construct the pathname of the user's recent common file. */
-  rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE, FALSE);
+  rf_path = get_persconffile_path(RECENT_COMMON_FILE_NAME, FALSE);
   if (!file_exists (rf_path)) {
     /* Recent common file does not exist, read from default recent */
     g_free (rf_path);
-    rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE, FALSE);
+    rf_path = get_persconffile_path(RECENT_FILE_NAME, FALSE);
   }
 
   /* Read the user's recent file, if it exists. */
index 3163f24f42ac6aac8e87e1b95547b1b097ca2b48..13bb7adfbe325f51e03a37e40d4701e424edfaaf 100644 (file)
--- a/update.c
+++ b/update.c
@@ -301,7 +301,7 @@ update_check(gboolean interactive)
 
     /* build update file name */
     /* XXX - using the personal path, use temp dir instead? */
-    local_file = get_persconffile_path("wsupdate", FALSE, TRUE /*for_writing*/);
+    local_file = get_persconffile_path("wsupdate", FALSE);
     if(local_file == NULL) {
         g_warning("Couldn't create output path!");
         return;