static char **cld_argv;
static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
{
- struct child_process cld = { 0 };
+ struct child_process cld = { NULL };
char addrbuf[300] = "REMOTE_ADDR=", portbuf[300];
char *env[] = { addrbuf, portbuf, NULL };
/* prepare argv for serving-processes */
cld_argv = xmalloc(sizeof (char *) * (argc + 2));
- for (i = 0; i < argc; ++i)
- cld_argv[i] = argv[i];
- cld_argv[argc] = "--serve";
+ cld_argv[0] = argv[0]; /* git-daemon */
+ cld_argv[1] = "--serve";
+ for (i = 1; i < argc; ++i)
+ cld_argv[i+1] = argv[i];
cld_argv[argc+1] = NULL;
return serve(&listen_addr, listen_port, cred);