diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-07-11 14:04:03 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-07-11 14:04:03 -0700 |
commit | 31ca831339412615bb2ba88b0cc706b960f9410f (patch) | |
tree | d34dbf099ddb06aeb54600d25fce2d61918635e1 /plugins | |
parent | 5ee5a6fecda9aea1ba06a42b02901f1f89fb2dfc (diff) | |
download | connman-31ca831339412615bb2ba88b0cc706b960f9410f.tar.gz connman-31ca831339412615bb2ba88b0cc706b960f9410f.tar.bz2 connman-31ca831339412615bb2ba88b0cc706b960f9410f.zip |
Track killed status of dhclient tasks
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/dhclient.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/dhclient.c b/plugins/dhclient.c index 10f32ff6..90f8e2f5 100644 --- a/plugins/dhclient.c +++ b/plugins/dhclient.c @@ -41,6 +41,7 @@ static const char *busname; struct dhclient_task { GPid pid; + gboolean killed; int ifindex; gchar *ifname; struct connman_element *element; @@ -80,8 +81,13 @@ static void kill_task(struct dhclient_task *task) { DBG("task %p name %s pid %d", task, task->ifname, task->pid); - if (task->pid > 0) + if (task->killed == TRUE) + return; + + if (task->pid > 0) { + task->killed = TRUE; kill(task->pid, SIGTERM); + } } static void unlink_task(struct dhclient_task *task) @@ -126,6 +132,8 @@ static void task_setup(gpointer data) struct dhclient_task *task = data; DBG("task %p name %s", task, task->ifname); + + task->killed = FALSE; } static int dhclient_probe(struct connman_element *element) @@ -203,9 +211,6 @@ static void dhclient_remove(struct connman_element *element) DBG("element %p name %s", element, element->name); task = find_task_by_index(element->index); - if (task != NULL) - task_list = g_slist_remove(task_list, task); - if (task == NULL) return; |