path: root/src
diff options
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-08-27 18:46:48 -0300
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-08-28 19:06:20 -0300
commitd4982955787817ad17aec6de9308c8f1d7ed0b92 (patch)
tree5f94c570ea28efdb3f6f050d12bae6a2ce214c5e /src
parent8a68b5fe931db5a432f924b0de22ed3acee024ba (diff)
Storage cleanup: avoid Bluetooth address to string conversions
Diffstat (limited to 'src')
3 files changed, 4 insertions, 7 deletions
diff --git a/src/device.c b/src/device.c
index 3ba4aa92..b41c6ff5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -262,12 +262,9 @@ static DBusMessage *set_trust(DBusConnection *conn, DBusMessage *msg,
struct btd_device *device = data;
struct adapter *adapter = device->adapter;
- bdaddr_t local;
const gchar *source = adapter_get_address(adapter);
- str2ba(source, &local);
- write_trust(&local, device->address, GLOBAL_TRUST, value);
+ write_trust(source, device->address, GLOBAL_TRUST, value);
dbus_connection_emit_property_changed(conn, dbus_message_get_path(msg),
diff --git a/src/storage.c b/src/storage.c
index 3cdc9113..f85dbb53 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -608,7 +608,7 @@ static char *service_list_to_string(GSList *services)
return g_strdup(str);
-int write_trust(bdaddr_t *local, const char *addr, const char *service,
+int write_trust(const char *src, const char *addr, const char *service,
gboolean trust)
char filename[PATH_MAX + 1], *str;
@@ -616,7 +616,7 @@ int write_trust(bdaddr_t *local, const char *addr, const char *service,
gboolean trusted;
int ret;
- create_filename(filename, PATH_MAX, local, "trusts");
+ create_name(filename, PATH_MAX, STORAGEDIR, src, "trusts");
create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
diff --git a/src/storage.h b/src/storage.h
index a9bda390..8a06d4e3 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -52,7 +52,7 @@ int read_link_key(bdaddr_t *local, bdaddr_t *peer, unsigned char *key, uint8_t *
int read_pin_length(bdaddr_t *local, bdaddr_t *peer);
int read_pin_code(bdaddr_t *local, bdaddr_t *peer, char *pin);
gboolean read_trust(const bdaddr_t *local, const char *addr, const char *service);
-int write_trust(bdaddr_t *local, const char *addr, const char *service, gboolean trust);
+int write_trust(const char *src, const char *addr, const char *service, gboolean trust);
GSList *list_trusts(bdaddr_t *local, const char *service);
int write_device_profiles(bdaddr_t *src, bdaddr_t *dst, const char *profiles);
int delete_entry(bdaddr_t *src, const char *storage, const char *key);