Skip to content

Commit 81c57e2

Browse files
drafnelgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3006297 commit 81c57e2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contrib/credential/gnome-keyring/git-credential-gnome-keyring.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ static int keyring_store(struct credential *c)
125125
{
126126
guint32 item_id;
127127
char *object = NULL;
128+
GnomeKeyringResult result;
128129

129130
/*
130131
* Sanity check that what we are storing is actually sensible.
@@ -139,7 +140,7 @@ static int keyring_store(struct credential *c)
139140

140141
object = keyring_object(c);
141142

142-
gnome_keyring_set_network_password_sync(
143+
result = gnome_keyring_set_network_password_sync(
143144
GNOME_KEYRING_DEFAULT,
144145
c->username,
145146
NULL /* domain */,
@@ -152,6 +153,13 @@ static int keyring_store(struct credential *c)
152153
&item_id);
153154

154155
g_free(object);
156+
157+
if (result != GNOME_KEYRING_RESULT_OK &&
158+
result != GNOME_KEYRING_RESULT_CANCELLED) {
159+
g_critical("%s", gnome_keyring_result_to_message(result));
160+
return EXIT_FAILURE;
161+
}
162+
155163
return EXIT_SUCCESS;
156164
}
157165

0 commit comments

Comments
 (0)