summaryrefslogtreecommitdiffstats
path: root/input/storage.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-25 15:06:06 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-25 15:06:06 +0000
commit24aaa3c3825fd26e34730fe64f5e375f7e94bb7d (patch)
tree5750a0082156f26156dfa19e16f9f15057e0ff3c /input/storage.c
parent682be0d86d85d9efde2778a0394ba5af32887d14 (diff)
Small cleanup
Diffstat (limited to 'input/storage.c')
-rw-r--r--input/storage.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/input/storage.c b/input/storage.c
index cc9f22db..0452a1e9 100644
--- a/input/storage.c
+++ b/input/storage.c
@@ -45,7 +45,7 @@
#include "storage.h"
static inline int create_filename(char *buf, size_t size,
- bdaddr_t *bdaddr, const char *name)
+ bdaddr_t *bdaddr, const char *name)
{
char addr[18];
@@ -66,7 +66,6 @@ int parse_stored_device_info(const char *str, struct hidp_connadd_req *req)
memset(desc, 0, 4096);
-
sscanf(str, "%04X:%04X:%04X %02X %02X %04X %4095s %08X %n",
&vendor, &product, &version, &subclass, &country,
&parser, desc, &req->flags, &pos);
@@ -99,11 +98,11 @@ int parse_stored_device_info(const char *str, struct hidp_connadd_req *req)
}
int get_stored_device_info(bdaddr_t *sba, bdaddr_t *dba,
- struct hidp_connadd_req *req)
+ struct hidp_connadd_req *req)
{
char filename[PATH_MAX + 1], *str;
char peer[18];
- int ret;
+ int err;
create_filename(filename, PATH_MAX, sba, "hidd");
@@ -112,11 +111,11 @@ int get_stored_device_info(bdaddr_t *sba, bdaddr_t *dba,
if (!str)
return -ENOENT;
- ret = parse_stored_device_info(str, req);
+ err = parse_stored_device_info(str, req);
free(str);
- return ret;
+ return err;
}
int del_stored_device_info(bdaddr_t *sba, bdaddr_t *dba)
@@ -134,7 +133,7 @@ int del_stored_device_info(bdaddr_t *sba, bdaddr_t *dba)
int store_device_info(bdaddr_t *sba, bdaddr_t *dba, struct hidp_connadd_req *req)
{
char filename[PATH_MAX + 1], *str, *desc;
- int i, size, ret;
+ int i, err, size;
char addr[18];
create_filename(filename, PATH_MAX, sba, "hidd");
@@ -158,14 +157,16 @@ int store_device_info(bdaddr_t *sba, bdaddr_t *dba, struct hidp_connadd_req *req
req->vendor, req->product, req->version,
req->subclass, req->country, req->parser, desc,
req->flags, req->name);
+
free(desc);
create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
ba2str(dba, addr);
- ret = textfile_put(filename, addr, str);
+ err = textfile_put(filename, addr, str);
+
free(str);
- return ret;
+ return err;
}