diff options
author | Paulo Alcantara <paulo.alcantara@openbossa.org> | 2012-07-27 16:43:16 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-07-29 20:07:09 +0200 |
commit | ae97e95200b46adaaf8a199d17c2a3c4447f6422 (patch) | |
tree | 712e89bb1e7945a48fcc1f44b2ec60893df33a8c /src/storage.c | |
parent | cb453953f06ee47a124d9710fd25b4607db947a7 (diff) |
storage: Store address type in "lastseen" file
Diffstat (limited to 'src/storage.c')
-rw-r--r-- | src/storage.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/storage.c b/src/storage.c index 252b383b..89c28e02 100644 --- a/src/storage.c +++ b/src/storage.c @@ -572,9 +572,10 @@ int read_remote_features(bdaddr_t *local, bdaddr_t *peer, return err; } -int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) +int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, uint8_t peer_type, + struct tm *tm) { - char filename[PATH_MAX + 1], addr[18], str[24]; + char filename[PATH_MAX + 1], key[20], str[24]; memset(str, 0, sizeof(str)); strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S %Z", tm); @@ -583,8 +584,10 @@ int write_lastseen_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - ba2str(peer, addr); - return textfile_put(filename, addr, str); + ba2str(peer, key); + sprintf(&key[17], "#%hhu", peer_type); + + return textfile_put(filename, key, str); } int write_lastused_info(bdaddr_t *local, bdaddr_t *peer, struct tm *tm) |