aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-07-29 01:18:08 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-07-29 01:18:36 +0800
commit7ca5681a186857349762f2c06e08dedaee1287a3 (patch)
treee39746c59127a84c98e236b493bed26edb8643b4
parentd369274ae88a331f19630750ec485ccbcc8b2b3e (diff)
downloadgsoc2013-evolution-7ca5681a186857349762f2c06e08dedaee1287a3.tar.gz
gsoc2013-evolution-7ca5681a186857349762f2c06e08dedaee1287a3.tar.zst
gsoc2013-evolution-7ca5681a186857349762f2c06e08dedaee1287a3.zip
Remove .goutputstream-XXXXXX files during migration.
GIO had a bug for awhile where it would leave behind an empty temp file with the pattern .goutputstream-XXXXXX if an output stream operation was cancelled. We've had several reports of these files in config directories, so remove any we find.
-rw-r--r--shell/e-shell-migrate.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/shell/e-shell-migrate.c b/shell/e-shell-migrate.c
index 674c8c3f61..faf8435928 100644
--- a/shell/e-shell-migrate.c
+++ b/shell/e-shell-migrate.c
@@ -196,11 +196,13 @@ shell_xdg_migrate_config_dir_common (EShell *shell,
const gchar *old_base_dir,
const gchar *backend_name)
{
+ GDir *dir;
const gchar *user_config_dir;
gchar *old_config_dir;
gchar *new_config_dir;
gchar *old_filename;
gchar *new_filename;
+ gchar *dirname;
user_config_dir = e_get_user_config_dir ();
@@ -228,6 +230,35 @@ shell_xdg_migrate_config_dir_common (EShell *shell,
g_free (old_filename);
g_free (new_filename);
+ /* GIO had a bug for awhile where it would leave behind an empty
+ * temp file with the pattern .goutputstream-XXXXXX if an output
+ * stream operation was cancelled. We've had several reports of
+ * these files in config directories, so remove any we find. */
+ dirname = g_build_filename (old_config_dir, "config", NULL);
+ dir = g_dir_open (dirname, 0, NULL);
+ if (dir != NULL) {
+ const gchar *basename;
+
+ while ((basename = g_dir_read_name (dir)) != NULL) {
+ gchar *filename;
+ struct stat st;
+
+ if (!g_str_has_prefix (basename, ".goutputstream"))
+ continue;
+
+ filename = g_build_filename (dirname, basename, NULL);
+
+ /* Verify the file is indeed empty. */
+ if (g_stat (filename, &st) == 0 && st.st_size == 0)
+ g_unlink (filename);
+
+ g_free (filename);
+ }
+
+ g_dir_close (dir);
+ }
+ g_free (dirname);
+
g_free (old_config_dir);
g_free (new_config_dir);
}