summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Brandon Casey <drafnel@gmail.com>2013-09-23 11:49:15 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-10-16 09:35:33 -0700
commit81c57e2c9d99ced72bcc6b9633109dff73a04526 (patch)
tree32bd6aa2fa0abcc13af27910f12082738f27cb80
parentcontrib/git-credential-gnome-keyring.c: use glib messaging functions (diff)
downloadtgif-81c57e2c9d99ced72bcc6b9633109dff73a04526.tar.xz
contrib/git-credential-gnome-keyring.c: report failure to store password
Produce an error message when we fail to store a password to the keyring. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--contrib/credential/gnome-keyring/git-credential-gnome-keyring.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
index b70bd53959..447e9aa551 100644
--- a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
+++ b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
@@ -125,6 +125,7 @@ static int keyring_store(struct credential *c)
{
guint32 item_id;
char *object = NULL;
+ GnomeKeyringResult result;
/*
* Sanity check that what we are storing is actually sensible.
@@ -139,7 +140,7 @@ static int keyring_store(struct credential *c)
object = keyring_object(c);
- gnome_keyring_set_network_password_sync(
+ result = gnome_keyring_set_network_password_sync(
GNOME_KEYRING_DEFAULT,
c->username,
NULL /* domain */,
@@ -152,6 +153,13 @@ static int keyring_store(struct credential *c)
&item_id);
g_free(object);
+
+ if (result != GNOME_KEYRING_RESULT_OK &&
+ result != GNOME_KEYRING_RESULT_CANCELLED) {
+ g_critical("%s", gnome_keyring_result_to_message(result));
+ return EXIT_FAILURE;
+ }
+
return EXIT_SUCCESS;
}