struct connman_task {
char *path;
pid_t pid;
+ guint child_watch;
GPtrArray *argv;
GPtrArray *envp;
connman_task_exit_t exit_func;
if (task->pid > 0)
kill(task->pid, SIGTERM);
+ if (task->child_watch > 0)
+ g_source_remove(task->child_watch);
+
g_ptr_array_foreach(task->envp, free_pointer, NULL);
g_ptr_array_free(task->envp, TRUE);
g_spawn_close_pid(pid);
task->pid = -1;
+ task->child_watch = 0;
+
if (task->exit_func)
task->exit_func(task, task->exit_data);
}
return -EIO;
}
- g_child_watch_add(task->pid, task_died, task);
+ task->child_watch = g_child_watch_add(task->pid, task_died, task);
return 0;
}