]> git.ipfire.org Git - thirdparty/git.git/commitdiff
credential-cache: use child_process.args
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Aug 2020 21:37:39 +0000 (14:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Aug 2020 15:32:16 +0000 (08:32 -0700)
As child_process structure has an embedded strvec args for
formulating the command line, let's use it instead of using
an out-of-line argv[] whose length needs to be maintained
correctly.

Also, when spawning a git subcommand, omit it from the command list
and instead use the .git_cmd bit in the child_process structure.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
credential-cache.c

index 1cccc3a0b9cfb2a14e9c87d5afc29234fa62adc4..04df61cf020d37db5a71e0d98932f8236a2c581e 100644 (file)
@@ -39,13 +39,13 @@ static int send_request(const char *socket, const struct strbuf *out)
 static void spawn_daemon(const char *socket)
 {
        struct child_process daemon = CHILD_PROCESS_INIT;
-       const char *argv[] = { NULL, NULL, NULL };
        char buf[128];
        int r;
 
-       argv[0] = "git-credential-cache--daemon";
-       argv[1] = socket;
-       daemon.argv = argv;
+       strvec_pushl(&daemon.args,
+                    "credential-cache--daemon", socket,
+                    NULL);
+       daemon.git_cmd = 1;
        daemon.no_stdin = 1;
        daemon.out = -1;