diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-10-27 17:04:11 +0000 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-10-27 17:04:11 +0000 | 
| commit | 7c985b0fb64f0a1e76b8be4b1e0584dab9a92d63 (patch) | |
| tree | b2c5ee2dbb0022b8a0524be43e5effc580223975 | |
| parent | a15706f16167d14d958213840f5082dfdafd4ae7 (diff) | |
Return an error if the Stop is called and the service is not running
| -rw-r--r-- | hcid/dbus-service.c | 9 | 
1 files changed, 8 insertions, 1 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index dc1f7552..1d268280 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -406,7 +406,14 @@ static DBusHandlerResult stop(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");  | 
