diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-06-16 14:30:18 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-06-16 14:30:18 +0000 |
commit | a6957b9ac1e95063c71654cd7c352bc9b634754e (patch) | |
tree | 6b4c707057909ab5bc808848bd0cb30062bcf26f /hcid/dbus-service.c | |
parent | 9fd6757e19e57f085b2ebf72b1078edbd4b7285e (diff) |
Propagate local server address to services
Diffstat (limited to 'hcid/dbus-service.c')
-rw-r--r-- | hcid/dbus-service.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 27d4bbad..1fa7a96b 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -43,6 +43,7 @@ #include "dbus-helper.h" #include "hcid.h" #include "notify.h" +#include "server.h" #include "dbus-common.h" #include "dbus-error.h" #include "dbus-manager.h" @@ -408,7 +409,7 @@ static gboolean service_startup_timeout(gpointer data) int service_start(struct service *service, DBusConnection *conn) { DBusError derr; - char *argv[2], command[PATH_MAX]; + char *addr, *argv[2], *envp[2], command[PATH_MAX], address[256]; if (!dbus_connection_add_filter(conn, service_filter, service, NULL)) { error("Unable to add signal filter"); @@ -425,11 +426,19 @@ int service_start(struct service *service, DBusConnection *conn) } snprintf(command, sizeof(command) - 1, "%s/bluetoothd-service-%s", - SERVICEDIR, service->ident); + SERVICEDIR, service->ident); argv[0] = command; argv[1] = NULL; - if (!g_spawn_async(SERVICEDIR, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, + addr = get_local_server_address(); + + snprintf(address, sizeof(address) - 1, "BLUETOOTHD_ADDRESS=%s", addr); + envp[0] = address; + envp[1] = NULL; + + dbus_free(addr); + + if (!g_spawn_async(SERVICEDIR, argv, envp, G_SPAWN_DO_NOT_REAP_CHILD, service_setup, service, &service->pid, NULL)) { error("Unable to execute %s", argv[0]); dbus_connection_remove_filter(conn, service_filter, service); |