summaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-11 17:33:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-11 17:33:27 (GMT)
commit825fd93767510895a98ad7f12e3c1af3e40e367b (patch)
treeea3b4beac8dae69e2b45c9bfb8ce2cc21f462499 /daemon.c
parent49feda62bddc188d8b2fa413437b5fc70e3de51f (diff)
parent1f87293d78a4b2bd9265bac49b14a6f1111918b8 (diff)
downloadgit-825fd93767510895a98ad7f12e3c1af3e40e367b.zip
git-825fd93767510895a98ad7f12e3c1af3e40e367b.tar.gz
git-825fd93767510895a98ad7f12e3c1af3e40e367b.tar.bz2
Merge branch 'rs/child-process-init'
Code clean-up. * rs/child-process-init: run-command: inline prepare_run_command_v_opt() run-command: call run_command_v_opt_cd_env() instead of duplicating it run-command: introduce child_process_init() run-command: introduce CHILD_PROCESS_INIT
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/daemon.c b/daemon.c
index 6f78b61..4dcfff9 100644
--- a/daemon.c
+++ b/daemon.c
@@ -242,7 +242,7 @@ static const char *access_hook;
static int run_access_hook(struct daemon_service *service, const char *dir, const char *path)
{
- struct child_process child;
+ struct child_process child = CHILD_PROCESS_INIT;
struct strbuf buf = STRBUF_INIT;
const char *argv[8];
const char **arg = argv;
@@ -260,7 +260,6 @@ static int run_access_hook(struct daemon_service *service, const char *dir, cons
*arg = NULL;
#undef STRARG
- memset(&child, 0, sizeof(child));
child.use_shell = 1;
child.argv = argv;
child.no_stdin = 1;
@@ -388,9 +387,8 @@ static void copy_to_log(int fd)
static int run_service_command(const char **argv)
{
- struct child_process cld;
+ struct child_process cld = CHILD_PROCESS_INIT;
- memset(&cld, 0, sizeof(cld));
cld.argv = argv;
cld.git_cmd = 1;
cld.err = -1;
@@ -715,7 +713,7 @@ static void check_dead_children(void)
static char **cld_argv;
static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
{
- struct child_process cld = { NULL };
+ struct child_process cld = CHILD_PROCESS_INIT;
char addrbuf[300] = "REMOTE_ADDR=", portbuf[300];
char *env[] = { addrbuf, portbuf, NULL };