summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-08-16 23:30:14 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-08-16 23:30:14 +0000
commit6cfc40dfe5fa7884acaa3ec50bae78475c968a7d (patch)
tree117a15abdd58f800f076be83d388e749c4e1a978
parent2c0e2fcf82a062558526ae164796855b584603f0 (diff)
Create server address file
-rw-r--r--hcid/server.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/hcid/server.c b/hcid/server.c
index a9878f06..e755d812 100644
--- a/hcid/server.c
+++ b/hcid/server.c
@@ -25,7 +25,11 @@
#include <config.h>
#endif
+#include <fcntl.h>
+#include <unistd.h>
#include <string.h>
+#include <sys/stat.h>
+
#include <dbus.h>
#include "dbus-database.h"
@@ -96,6 +100,7 @@ void init_local_server(void)
const char *ext_only[] = { "EXTERNAL", NULL };
char *address;
DBusError err;
+ int fd, len;
dbus_error_init(&err);
@@ -110,6 +115,15 @@ void init_local_server(void)
info("Created local server at %s", address);
+ fd = open("/var/run/bluetoothd_address",
+ O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR);
+ if (fd < 0) {
+ error("Can't create server address file");
+ } else {
+ len = write(fd, address, strlen(address));
+ close(fd);
+ }
+
dbus_free(address);
//dbus_server_setup_with_g_main(server, NULL);
@@ -128,6 +142,9 @@ void shutdown_local_server(void)
info("Shutting down local server");
+ if (unlink("/var/run/bluetoothd_address") < 0)
+ error("Can't remove server address file");
+
dbus_server_disconnect(server);
dbus_server_unref(server);