+ talloc_free(task);
+ result->task = NULL;
+
+ cb(result, data);
+}
+
+static void load_process_to_local_file(struct load_task *task,
+ const char **argv, int argv_local_idx)
+{
+ int rc;
+
+ task->result->local = local_name(task->result);
+ if (!task->result->local) {
+ task->result->status = LOAD_ERROR;
+ return;
+ }
+ task->result->cleanup_local = true;
+
+ if (argv_local_idx)
+ argv[argv_local_idx] = task->result->local;
+
+ task->process->argv = argv;
+ task->process->path = argv[0];
+
+ if (task->async) {
+ rc = process_run_async(task->process);
+ if (rc) {
+ process_release(task->process);
+ task->process = NULL;
+ }
+ task->result->status = rc ? LOAD_ERROR : LOAD_ASYNC;
+ } else {
+ rc = process_run_sync(task->process);
+ if (rc || !process_exit_ok(task->process))
+ task->result->status = LOAD_ERROR;
+ else
+ task->result->status = LOAD_OK;
+ process_release(task->process);
+ task->process = NULL;
+ }