summaryrefslogtreecommitdiff
path: root/src/task.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/task.c')
-rw-r--r--src/task.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/task.c b/src/task.c
index 541106ca..a74c7284 100644
--- a/src/task.c
+++ b/src/task.c
@@ -246,11 +246,15 @@ int connman_task_set_notify(struct connman_task *task, const char *member,
static void task_died(GPid pid, gint status, gpointer user_data)
{
struct connman_task *task = user_data;
+ int exit_code;
- if (WIFEXITED(status))
- DBG("task %p exit status %d", task, WEXITSTATUS(status));
- else
+ if (WIFEXITED(status)) {
+ exit_code = WEXITSTATUS(status);
+ DBG("task %p exit status %d", task, exit_code);
+ } else {
+ exit_code = 0;
DBG("task %p signal %d", task, WTERMSIG(status));
+ }
g_spawn_close_pid(pid);
task->pid = -1;
@@ -258,7 +262,7 @@ static void task_died(GPid pid, gint status, gpointer user_data)
task->child_watch = 0;
if (task->exit_func)
- task->exit_func(task, task->exit_data);
+ task->exit_func(task, exit_code, task->exit_data);
}
static void task_setup(gpointer user_data)