[PATCH 2/5 v2] Call task exit function with vpn client exit code.

Mohamed Abbas mabbas at linux.intel.com
Thu Jan 27 12:25:54 PST 2011


Pass vpn client exit code value to vpn to match to provider
error code.
---
 include/task.h |    2 +-
 src/task.c     |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/task.h b/include/task.h
index f608c7e..bde2a29 100644
--- a/include/task.h
+++ b/include/task.h
@@ -37,7 +37,7 @@ extern "C" {
 struct connman_task;
 
 typedef void (* connman_task_exit_t) (struct connman_task *task,
-							void *user_data);
+						int exit_code, void *user_data);
 
 typedef void (* connman_task_notify_t) (struct connman_task *task,
 				DBusMessage *message, void *user_data);
diff --git a/src/task.c b/src/task.c
index 541106c..a74c728 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)
-- 
1.7.3.4




More information about the connman mailing list