aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-02-18 08:45:52 +0100
committerJunio C Hamano <gitster@pobox.com>2025-02-18 11:40:03 -0800
commita47b8733b3f7db0c0db8cbfbdfc0aa2c197af6ee (patch)
tree3b2a5e7c5b9b73281bcb28326ecb75d92a7ccbcc
parentf8d95a323a088d88b5db1dd1cb2d554ac73caa10 (diff)
downloadgit-a47b8733b3f7db0c0db8cbfbdfc0aa2c197af6ee.tar.gz
contrib/credential: fix compiling "libsecret" helper
The "libsecret" credential helper does not compile when developer warnings are enabled due to three warnings: - contrib/credential/libsecret/git-credential-libsecret.c:78:1: missing initializer for field ‘reserved’ of ‘SecretSchema’ [-Werror=missing-field-initializers]. This issue is fixed by using designated initializers. - contrib/credential/libsecret/git-credential-libsecret.c:171:43: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]. This issue is fixed by using an unsigned variable to iterate through the string vector. - contrib/credential/libsecret/git-credential-libsecret.c:420:14: unused parameter ‘argc’ [-Werror=unused-parameter]. This issue is fixed by checking the number of arguments, but in the least restrictive way possible. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--contrib/credential/libsecret/git-credential-libsecret.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c
index 90034d0cf1..941b2afd5e 100644
--- a/contrib/credential/libsecret/git-credential-libsecret.c
+++ b/contrib/credential/libsecret/git-credential-libsecret.c
@@ -59,10 +59,10 @@ static void credential_clear(struct credential *c);
/* ----------------- Secret Service functions ----------------- */
static const SecretSchema schema = {
- "org.git.Password",
+ .name = "org.git.Password",
/* Ignore schema name during search for backwards compatibility */
- SECRET_SCHEMA_DONT_MATCH_NAME,
- {
+ .flags = SECRET_SCHEMA_DONT_MATCH_NAME,
+ .attributes = {
/*
* libsecret assumes attribute values are non-confidential and
* unchanging, so we can't include oauth_refresh_token or
@@ -168,7 +168,7 @@ static int keyring_get(struct credential *c)
g_free(c->password);
c->password = g_strdup("");
}
- for (int i = 1; i < g_strv_length(parts); i++) {
+ for (guint i = 1; i < g_strv_length(parts); i++) {
if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
g_free(c->password_expiry_utc);
c->password_expiry_utc = g_strdup(&parts[i][20]);
@@ -424,7 +424,7 @@ int main(int argc, char *argv[])
struct credential_operation const *try_op = credential_helper_ops;
struct credential cred = CREDENTIAL_INIT;
- if (!argv[1]) {
+ if (argc < 2 || !*argv[1]) {
usage(argv[0]);
exit(EXIT_FAILURE);
}