]> git.0d.be Git - empathy.git/commitdiff
Check whether ~/.purple/accounts.xml is readable before trying to read it. (Jonny...
authorJonny Lamb <jonny.lamb@collabora.co.uk>
Fri, 17 Oct 2008 12:47:15 +0000 (12:47 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 17 Oct 2008 12:47:15 +0000 (12:47 +0000)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=1620

src/empathy-import-dialog.c

index e726e1e3c57287b108de21f00edb2d6f527c8db4..ad90a8e1777d6624cbf4a859f840efbadf330cd9 100644 (file)
@@ -27,6 +27,7 @@
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 #include <glib/gi18n.h>
+#include <glib/gstdio.h>
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -284,8 +285,11 @@ import_dialog_pidgin_load (void)
   ctxt = xmlNewParserCtxt ();
   filename = g_build_filename (g_get_home_dir (), ".purple", "accounts.xml",
       NULL);
+
+  if (g_access (filename, R_OK) != 0)
+    goto FILENAME;
+
   doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
-  g_free (filename);
 
   rootnode = xmlDocGetRootElement (doc);
   if (rootnode == NULL)
@@ -408,6 +412,9 @@ OUT:
   xmlFreeDoc(doc);
   xmlFreeParserCtxt (ctxt);
 
+FILENAME:
+  g_free (filename);
+
   return accounts;
 }