summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-09-06 10:35:25 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2010-09-10 12:23:41 +0100
commit88df560e88cf14e3fc6b0b6060173dd94e3ecaed (patch)
tree7b6d431028733b9784c75da127fc156735da2eb7
parent107927b9efc7760f69d368525c969d3ee33ecb3e (diff)
Bug 628853 — hangs if there's no relationships.ini file
The code to create the directory tree for relationships.ini wasn't handling errors properly, so was getting stuck in an infinite loop in the case that the ~/.local/share/folks directory existed but relationships.ini didn't. Closes: bgo#628853
-rw-r--r--backends/key-file/kf-persona-store.vala23
1 files changed, 19 insertions, 4 deletions
diff --git a/backends/key-file/kf-persona-store.vala b/backends/key-file/kf-persona-store.vala
index 885be12..3a81bdd 100644
--- a/backends/key-file/kf-persona-store.vala
+++ b/backends/key-file/kf-persona-store.vala
@@ -109,15 +109,30 @@ public class Folks.Backends.Kf.PersonaStore : Folks.PersonaStore
}
}
- /* Create a new file; if this fails due to the file having been
- * created in the meantime, we can loop back round and try and load
- * it. */
+ /* Ensure the parent directory tree exists for the new file */
+ File parent_dir = this.file.get_parent ();
+
try
{
/* Recursively create the directory */
- File parent_dir = this.file.get_parent ();
parent_dir.make_directory_with_parents ();
+ }
+ catch (Error e3)
+ {
+ if (!(e3 is IOError.EXISTS))
+ {
+ warning ("The relationship key file directory '%s' could " +
+ "not be created: %s", parent_dir.get_path (), e3.message);
+ this.removed ();
+ return;
+ }
+ }
+ /* Create a new file; if this fails due to the file having been
+ * created in the meantime, we can loop back round and try and load
+ * it. */
+ try
+ {
/* Create the file */
FileOutputStream stream = yield this.file.create_async (
FileCreateFlags.PRIVATE, Priority.DEFAULT);