summaryrefslogtreecommitdiffstats
path: root/hidd
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-08-30 00:35:39 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-08-30 00:35:39 +0000
commit44385c0baa98b0e27dad39cb8bd0e33ce5a027f6 (patch)
treee216d9746db798291f00dade69b46f33fdf2ff45 /hidd
parent3882b4e761ed1411406e375ec1b4b0790509939e (diff)
Move create_dirs() and create_file() into the textfile library
Diffstat (limited to 'hidd')
-rw-r--r--hidd/sdp.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/hidd/sdp.c b/hidd/sdp.c
index 05cacf45..ea76894b 100644
--- a/hidd/sdp.c
+++ b/hidd/sdp.c
@@ -77,7 +77,7 @@ static void epox_endian_quirk(unsigned char *data, int size)
static int store_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp_connadd_req *req)
{
char filename[PATH_MAX + 1], addr[18], *str, *desc;
- int i, fd, size;
+ int i, size;
ba2str(src, addr);
snprintf(filename, PATH_MAX, "%s/%s/hidd", STORAGEDIR, addr);
@@ -102,11 +102,7 @@ static int store_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hi
req->subclass, req->country, req->parser, desc,
req->flags, req->name);
- fd = open(filename, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
- if (fd < 0)
- return -errno;
-
- close(fd);
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
ba2str(dst, addr);
return textfile_put(filename, addr, str);