path: root/run-command.h
diff options
authorStefan Beller <>2016-02-29 21:57:06 (GMT)
committerJunio C Hamano <>2016-03-01 17:42:01 (GMT)
commit2a73b3dad09ef162eb5917e9e0d01d7c306f6b35 (patch)
treed3566e6ddadb7f1cdeb0a520b125e9cbac164e77 /run-command.h
parent62104ba14af4845c6c1ba1dab05fad4a289d806f (diff)
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 <>
Diffstat (limited to 'run-command.h')
1 files changed, 3 insertions, 6 deletions
diff --git a/run-command.h b/run-command.h
index d5a57f9..6e17894 100644
--- a/run-command.h
+++ b/run-command.h
@@ -158,8 +158,7 @@ typedef int (*get_next_task_fn)(struct child_process *cp,
* To send a signal to other child processes for abortion, return
* the negative signal number.
-typedef int (*start_failure_fn)(struct child_process *cp,
- struct strbuf *err,
+typedef int (*start_failure_fn)(struct strbuf *err,
void *pp_cb,
void *pp_task_cb);
@@ -178,7 +177,6 @@ typedef int (*start_failure_fn)(struct child_process *cp,
* the negative signal number.
typedef int (*task_finished_fn)(int result,
- struct child_process *cp,
struct strbuf *err,
void *pp_cb,
void *pp_task_cb);
@@ -192,9 +190,8 @@ typedef int (*task_finished_fn)(int result,
* (both stdout and stderr) is routed to stderr in a manner that output
* from different tasks does not interleave.
- * If start_failure_fn or task_finished_fn are NULL, default handlers
- * will be used. The default handlers will print an error message on
- * error without issuing an emergency stop.
+ * start_failure_fn and task_finished_fn can be NULL to omit any
+ * special handling.
int run_processes_parallel(int n,