summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-service.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-01-17 22:07:09 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-01-17 22:07:09 +0000
commit32ac51cb2720108543d44961ed4cbcd23f519317 (patch)
treeb309ba601ccff128d92ef137361c400a6e198b1c /hcid/dbus-service.c
parent6cba32a71da4d64f39ce8d54e2504b215c3f054d (diff)
Kill service if necessary when aborting startup
Diffstat (limited to 'hcid/dbus-service.c')
-rw-r--r--hcid/dbus-service.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c
index 4d416929..8115a693 100644
--- a/hcid/dbus-service.c
+++ b/hcid/dbus-service.c
@@ -414,6 +414,10 @@ static void abort_startup(struct service *service, DBusConnection *conn, int eco
dbus_message_unref(service->action);
service->action = NULL;
}
+
+ if (service->pid && kill(service->pid, SIGKILL) < 0)
+ error("kill(%d, SIGKILL): %s (%d)", service->pid,
+ strerror(errno), errno);
}
static void service_died(GPid pid, gint status, gpointer data)
@@ -423,6 +427,9 @@ static void service_died(GPid pid, gint status, gpointer data)
debug("%s (%s) exited with status %d", service->exec, service->name,
status);
+ g_spawn_close_pid(pid);
+ service->pid = 0;
+
if (service->startup_timer)
abort_startup(service, get_dbus_connection(), ECANCELED);
@@ -431,9 +438,6 @@ static void service_died(GPid pid, gint status, gpointer data)
service->shutdown_timer = 0;
}
- g_spawn_close_pid(pid);
-
- service->pid = 0;
}