summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-04-21 20:18:09 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-04-21 20:18:09 +0000
commitf5a214f76f2d93702b5bc3b0b168389d8f8b34f2 (patch)
tree71dcdb11c6b15cc2849fa46abe15d6492d080a63 /hcid
parentacea732b00a0f48d1e4414b303f6b2c49e71cbbe (diff)
Set the storage directory through ${localstatedir}
Diffstat (limited to 'hcid')
-rw-r--r--hcid/storage.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index ffc92b44..b225b598 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -46,8 +46,6 @@
#include "hcid.h"
-#define DEVPATH "/var/lib/bluetooth/"
-
struct list {
bdaddr_t bdaddr;
unsigned char *data;
@@ -171,7 +169,7 @@ int write_device_name(const bdaddr_t *local, const bdaddr_t *peer, const char *n
int fd, pos, err = 0;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/names", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/names", STORAGEDIR, addr);
umask(S_IWGRP | S_IWOTH);
create_dirs(filename, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
@@ -250,7 +248,7 @@ int read_device_name(const bdaddr_t *local, const bdaddr_t *peer, char *name)
int fd, pos, err = -ENOENT;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/names", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/names", STORAGEDIR, addr);
fd = open(filename, O_RDONLY);
if (fd < 0)
@@ -312,7 +310,7 @@ int write_version_info(const bdaddr_t *local, const bdaddr_t *peer, const uint16
int fd, pos, err = 0;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/manufacturers", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/manufacturers", STORAGEDIR, addr);
umask(S_IWGRP | S_IWOTH);
create_dirs(filename, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
@@ -395,7 +393,7 @@ int write_features_info(const bdaddr_t *local, const bdaddr_t *peer, const unsig
int i, fd, pos, err = 0;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/features", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/features", STORAGEDIR, addr);
umask(S_IWGRP | S_IWOTH);
create_dirs(filename, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
@@ -479,7 +477,7 @@ int write_link_key(const bdaddr_t *local, const bdaddr_t *peer, const unsigned c
int i, fd, pos, err = 0;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/linkkeys", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/linkkeys", STORAGEDIR, addr);
umask(S_IWGRP | S_IWOTH);
create_dirs(filename, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
@@ -563,7 +561,7 @@ int read_link_key(const bdaddr_t *local, const bdaddr_t *peer, unsigned char *ke
int i, fd, pos, err = -ENOENT;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/linkkeys", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/linkkeys", STORAGEDIR, addr);
fd = open(filename, O_RDONLY);
if (fd < 0)
@@ -628,7 +626,7 @@ int read_pin_code(const bdaddr_t *local, const bdaddr_t *peer, char *pin)
int fd, pos, err = -ENOENT;
ba2str(local, addr);
- snprintf(filename, PATH_MAX, "%s/%s/pincodes", DEVPATH, addr);
+ snprintf(filename, PATH_MAX, "%s/%s/pincodes", STORAGEDIR, addr);
fd = open(filename, O_RDONLY);
if (fd < 0)