[gnome-online-accounts] Don't assume that secret_password_clear_sync() returns FALSE on error



commit fe57f4830d114638310589f47b36269bf504246b
Author: Stef Walter <stefw gnome org>
Date:   Tue Jan 22 11:57:24 2013 +0100

    Don't assume that secret_password_clear_sync() returns FALSE on error
    
    The secret_password_clear_sync() function returns whether items were
    deleted or not, and returning FALSE does not indicate an error
    condition.
    
    Detect the error condition correctly, preventing erroneus error
    prompts about not being able to delete stuff from the keyring.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692276

 src/goabackend/goautils.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 5936df8..4cfd5aa 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -118,6 +118,7 @@ goa_utils_delete_credentials_sync (GoaProvider   *provider,
   gboolean ret;
   gchar *password_key;
   const gchar *identity;
+  GError *sec_error = NULL;
 
   g_return_val_if_fail (GOA_IS_PROVIDER (provider), FALSE);
   g_return_val_if_fail (GOA_IS_ACCOUNT (object), FALSE);
@@ -135,16 +136,18 @@ goa_utils_delete_credentials_sync (GoaProvider   *provider,
                                   goa_provider_get_credentials_generation (GOA_PROVIDER (provider)),
                                   identity);
 
-  if (!secret_password_clear_sync (&secret_password_schema,
-                                   cancellable,
-                                   NULL,
-                                   "goa-identity", password_key,
-                                   NULL))
+  secret_password_clear_sync (&secret_password_schema,
+                              cancellable,
+                              &sec_error,
+                              "goa-identity", password_key,
+                              NULL);
+  if (sec_error != NULL)
     {
       g_set_error_literal (error,
                            GOA_ERROR,
                            GOA_ERROR_FAILED, /* TODO: more specific */
                            _("Failed to delete credentials from the keyring"));
+      g_error_free (sec_error);
       goto out;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]