[gnome-color-manager] trivial: ignore the migration when the destination file already exists for some reason



commit 0414d7f012e2944e539e2464ca7a9b5c2cf1109d
Author: Richard Hughes <richard hughsie com>
Date:   Sun May 30 08:40:25 2010 +0100

    trivial: ignore the migration when the destination file already exists for some reason

 src/gcm-client.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 92f8be6..25842bf 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -1006,9 +1006,14 @@ gcm_client_possibly_migrate_config_file (GcmClient *client)
 	gdest = g_file_new_for_path (dest);
 	ret = g_file_copy (gsource, gdest, G_FILE_COPY_NONE, NULL, NULL, NULL, &error);
 	if (!ret) {
-		egg_warning ("failed to copy: %s", error->message);
+		/* does the file already exist? -- i.e. the schema version was reset */
+		if (error->domain != G_IO_ERROR ||
+		    error->code != G_IO_ERROR_EXISTS) {
+			egg_warning ("failed to copy: %s", error->message);
+			g_error_free (error);
+			goto out;
+		}
 		g_error_free (error);
-		goto out;
 	}
 
 	/* do not attempt to migrate this again */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]