]> git.ipfire.org Git - thirdparty/git.git/commitdiff
contrib/credential: fix compilation of "osxkeychain" helper
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 07:45:53 +0000 (08:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 19:40:03 +0000 (11:40 -0800)
The "osxkeychain" helper does not compile due to a warning generated by
the unused `argc` parameter. Fix the warning by checking for the minimum
number of required arguments explicitly in the least restrictive way
possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/credential/osxkeychain/git-credential-osxkeychain.c

index 1c8310d7fefca066ee5da304bc895cf43be063f2..611c9798b3ae5c1f8807fdcc86d27337abd0272f 100644 (file)
@@ -422,7 +422,7 @@ int main(int argc, const char **argv)
        const char *usage =
                "usage: git credential-osxkeychain <get|store|erase>";
 
-       if (!argv[1])
+       if (argc < 2 || !*argv[1])
                die("%s", usage);
 
        if (open(argv[0], O_RDONLY | O_EXLOCK) == -1)