summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-04-16 23:01:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-04-16 23:01:15 +0000
commite81077a3fca56047992b0da3282bd06a60f07cef (patch)
treed79a47124c23b0ebb9cb4ff76351af31fddc6613
parent12513fafd320f210190ab574383efe9591ce6c6e (diff)
Fix case if the link key is not found
-rw-r--r--hcid/storage.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index 468d273b..0d42d680 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -312,7 +312,7 @@ int read_link_key(const bdaddr_t *local, const bdaddr_t *peer, unsigned char *ke
char filename[PATH_MAX + 1], addr[18], str[35], tmp[3], *buf, *ptr;
bdaddr_t bdaddr;
struct stat st;
- int i, fd, pos, err = 0;
+ int i, fd, pos, err = -ENOENT;
ba2str(local, addr);
snprintf(filename, PATH_MAX, "%s/%s/linkkeys", DEVPATH, addr);
@@ -351,6 +351,7 @@ int read_link_key(const bdaddr_t *local, const bdaddr_t *peer, unsigned char *ke
memcpy(tmp, str + (i * 2), 2);
key[i] = (uint8_t) strtol(tmp, NULL, 16);
}
+ err = 0;
break;
}