diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-09-26 13:56:30 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-09-26 13:56:30 +0000 |
commit | 90e08a3db079ce84c9f49f46c48ef7c4b757a2e4 (patch) | |
tree | ddf08d70b537fa11338064a7896c3f8754403632 /hcid | |
parent | 09200aea99bdd29fb0f75b67162fbd958ef5df99 (diff) |
Protect ActivateService against executing a service twice if it is currently starting up
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus-error.c | 5 | ||||
-rw-r--r-- | hcid/dbus-error.h | 1 | ||||
-rw-r--r-- | hcid/manager.c | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/hcid/dbus-error.c b/hcid/dbus-error.c index 3f9a7ddc..f5a473e9 100644 --- a/hcid/dbus-error.c +++ b/hcid/dbus-error.c @@ -292,6 +292,11 @@ DBusHandlerResult error_disconnect_in_progress(DBusConnection *conn, DBusMessage return error_in_progress(conn, msg, "Disconnection in progress"); } +DBusHandlerResult error_service_start_in_progress(DBusConnection *conn, + DBusMessage *msg) +{ + return error_in_progress(conn, msg, "Service start in progress"); +} static const char *strsdperror(int err) { diff --git a/hcid/dbus-error.h b/hcid/dbus-error.h index 6a2036de..47fa40ca 100644 --- a/hcid/dbus-error.h +++ b/hcid/dbus-error.h @@ -64,3 +64,4 @@ DBusHandlerResult error_audit_already_exists(DBusConnection *conn, DBusMessage * DBusHandlerResult error_trusted_device_already_exists(DBusConnection *conn, DBusMessage *msg); DBusHandlerResult error_trusted_device_does_not_exists(DBusConnection *conn, DBusMessage *msg); DBusHandlerResult error_disconnect_in_progress(DBusConnection *conn, DBusMessage *msg); +DBusHandlerResult error_service_start_in_progress(DBusConnection *conn, DBusMessage *msg); diff --git a/hcid/manager.c b/hcid/manager.c index 8e0652cc..fa4e8eb1 100644 --- a/hcid/manager.c +++ b/hcid/manager.c @@ -285,6 +285,9 @@ static DBusHandlerResult activate_service(DBusConnection *conn, return send_message_and_unref(conn, reply); } + if (service->pid) + return error_service_start_in_progress(conn, msg); + if (service_start(service, conn) < 0) return error_failed(conn, msg, ENOEXEC); |