From e81077a3fca56047992b0da3282bd06a60f07cef Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 16 Apr 2005 23:01:15 +0000 Subject: Fix case if the link key is not found --- hcid/storage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } -- cgit