Skip to content

Commit

Permalink
contrib/git-credential-gnome-keyring.c: report failure to store password
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Oct 16, 2013
1 parent 3006297 commit 81c57e2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 */,
Expand All @@ -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;
}

Expand Down

0 comments on commit 81c57e2

Please sign in to comment.