Skip to content

Commit c0e190c

Browse files
committed
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 <[email protected]>
1 parent 7cff3b6 commit c0e190c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

credential-cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ static int send_request(const char *socket, const struct strbuf *out)
3939
static void spawn_daemon(const char *socket)
4040
{
4141
struct child_process daemon = CHILD_PROCESS_INIT;
42-
const char *argv[] = { NULL, NULL, NULL };
4342
char buf[128];
4443
int r;
4544

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;
4949
daemon.no_stdin = 1;
5050
daemon.out = -1;
5151

0 commit comments

Comments
 (0)