diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-08-10 11:21:43 +0200 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-08-15 19:40:45 -0400 |
commit | bea94f6f1d35fe175ec10d0928e686ee7e023e2b (patch) | |
tree | 4e857f9cd9183958f1c4aeb522578e95693bf9b2 /gsettings | |
parent | 0bdf55869a78c838edacfb4b2055de5597c9875d (diff) | |
download | gconf-bea94f6f1d35fe175ec10d0928e686ee7e023e2b.tar.gz |
GSettings migration: only write database on actual changes
The database was being rewritten in all cases of timestamp changes on
the migration scripts directory -- possibly even if a script had been
removed since last run (or other reasons).
Only rewrite the file if a new migration has actually been run.
Diffstat (limited to 'gsettings')
-rw-r--r-- | gsettings/gsettings-data-convert.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c index b0c8b9c8..eac6fd40 100644 --- a/gsettings/gsettings-data-convert.c +++ b/gsettings/gsettings-data-convert.c @@ -420,6 +420,7 @@ main (int argc, char *argv[]) struct stat statbuf; GError *error; gchar **converted; + gboolean changed; GDir *dir; const gchar *name; gchar *filename; @@ -448,6 +449,7 @@ main (int argc, char *argv[]) } load_state (&stored_mtime, &converted); + changed = FALSE; /* If the directory is not newer, exit */ if (stat (convert_dir, &statbuf) == 0) @@ -497,6 +499,7 @@ main (int argc, char *argv[]) converted = g_realloc (converted, (len + 2) * sizeof (gchar *)); converted[len] = g_strdup (name); converted[len + 1] = NULL; + changed = TRUE; } g_free (filename); @@ -504,7 +507,7 @@ main (int argc, char *argv[]) next: ; } - if (!dry_run) + if (changed && !dry_run) { if (!save_state (converted)) return 1; |