credential-cache: use child_process.args
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>
Junio C Hamano committed
Aug 26, 2020 at 14:37 UTC
c0e190c168becfd7d6c27cd868542295bd474742
1 file changed
+4
-4
credential-cache.c
+4
-4
@@ -39,13 +39,13 @@ static int send_request(const char *socket, const struct strbuf *out)
39
static void spawn_daemon(const char *socket)
40
{
41
struct child_process daemon = CHILD_PROCESS_INIT;
42
- const char *argv[] = { NULL, NULL, NULL };
42
char buf[128];
43
int r;
44
46
- argv[0] = "git-credential-cache--daemon";
47
- argv[1] = socket;
48
- daemon.argv = argv;
45
+ strvec_pushl(&daemon.args,
46
+ "credential-cache--daemon", socket,
47
+ NULL);
48
+ daemon.git_cmd = 1;
49
daemon.no_stdin = 1;
50
daemon.out = -1;
51