[folks] Bug 628853 — hangs if there's no relationships.ini file
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Bug 628853 — hangs if there's no relationships.ini file
- Date: Fri, 10 Sep 2010 16:18:13 +0000 (UTC)
commit 88df560e88cf14e3fc6b0b6060173dd94e3ecaed
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon Sep 6 10:35:25 2010 +0100
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
backends/key-file/kf-persona-store.vala | 23 +++++++++++++++++++----
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]