summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-10-27 16:56:27 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-10-27 16:56:27 +0000
commita15706f16167d14d958213840f5082dfdafd4ae7 (patch)
treec8e8a967401e8da0c20a77ad5f1583a4acdcc343
parent9323de9fb2af3db457516fc0d9b94da9db112e80 (diff)
Return an error if the service is already running
-rw-r--r--hcid/dbus-service.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c
index 53134a2c..dc1f7552 100644
--- a/hcid/dbus-service.c
+++ b/hcid/dbus-service.c
@@ -337,7 +337,14 @@ static DBusHandlerResult start(DBusConnection *conn,
DBusPendingCall *pending;
struct service_call *call_data;
struct service_agent *agent = data;
- DBusMessage *forward = dbus_message_copy(msg);
+ DBusMessage *forward;
+
+ if (agent->running)
+ return error_failed(conn, msg, EPERM);
+
+ forward = dbus_message_copy(msg);
+ if (!forward)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
dbus_message_set_destination(forward, agent->id);
dbus_message_set_interface(forward, "org.bluez.ServiceAgent");