From 2a73b3dad09ef162eb5917e9e0d01d7c306f6b35 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Mon, 29 Feb 2016 13:57:06 -0800 Subject: run-command: do not pass child process data into callbacks The expected way to pass data into the callback is to pass them via the customizable callback pointer. The error reporting in default_{start_failure, task_finished} is not user friendly enough, that we want to encourage using the child data for such purposes. Furthermore the struct child data is cleaned by the run-command API, before we access them in the callbacks, leading to use-after-free situations. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- submodule.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index b83939c294..916fc84aaa 100644 --- a/submodule.c +++ b/submodule.c @@ -705,8 +705,7 @@ static int get_next_submodule(struct child_process *cp, return 0; } -static int fetch_start_failure(struct child_process *cp, - struct strbuf *err, +static int fetch_start_failure(struct strbuf *err, void *cb, void *task_cb) { struct submodule_parallel_fetch *spf = cb; @@ -716,8 +715,8 @@ static int fetch_start_failure(struct child_process *cp, return 0; } -static int fetch_finish(int retvalue, struct child_process *cp, - struct strbuf *err, void *cb, void *task_cb) +static int fetch_finish(int retvalue, struct strbuf *err, + void *cb, void *task_cb) { struct submodule_parallel_fetch *spf = cb; -- cgit v1.2.1