[telepathy-mission-control/master] McdAccountManager: when loading account <-> connection cache make it explicit that we don't really care if it fails

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jun 2 09:11:46 PDT 2009


Coverity doesn't like it if we ignore the result of g_file_get_contents,
and it's not immediately clear when inspecting the code that contents
will be set to NULL on error (although g_file_get_contents does in fact
guarantee this, so this patch makes no functional change).
---
 src/mcd-account-manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index 800c299..c856672 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -232,7 +232,13 @@ list_connection_names_cb (const gchar * const *names, gsize n,
     guint i;
 
     DEBUG ("%" G_GSIZE_FORMAT " connections", n);
-    g_file_get_contents (priv->account_connections_file, &contents, NULL, NULL);
+
+    /* if the file has no contents, we don't really care why */
+    if (!g_file_get_contents (priv->account_connections_file, &contents,
+                              NULL, NULL))
+    {
+        contents = NULL;
+    }
 
     for (i = 0; i < n; i++)
     {
-- 
1.5.6.5




More information about the telepathy-commits mailing list