linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Inga Stotland <inga.stotland@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: brian.gix@intel.com, Inga Stotland <inga.stotland@intel.com>
Subject: [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored
Date: Wed,  5 Feb 2020 14:53:43 -0800	[thread overview]
Message-ID: <20200205225343.6271-1-inga.stotland@intel.com> (raw)

This handles a case when a Key Refresh procedure is in place with
no application keys stored in the keyring. When KR procedure is
finalized, the check for the presence of AppKeys storage directory
does not return failure if the directory does not exist.

Also, remove duplicate include.
---
 mesh/keyring.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mesh/keyring.c b/mesh/keyring.c
index 41cb2e980..4a6f9f27d 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -24,10 +24,10 @@
 #define _GNU_SOURCE
 #include <fcntl.h>
 #include <dirent.h>
+#include <errno.h>
 #include <limits.h>
 #include <stdio.h>
 #include <unistd.h>
-#include <dirent.h>
 
 #include <sys/stat.h>
 
@@ -166,7 +166,10 @@ bool keyring_finalize_app_keys(struct mesh_node *node, uint16_t net_idx)
 	snprintf(key_dir, PATH_MAX, "%s%s", node_path, app_key_dir);
 	dir = opendir(key_dir);
 	if (!dir) {
-		l_error("Failed to App Key storage directory: %s", key_dir);
+		if (errno == ENOENT)
+			return true;
+
+		l_error("Failed to open AppKey storage directory: %s", key_dir);
 		return false;
 	}
 
-- 
2.21.1


             reply	other threads:[~2020-02-05 22:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 22:53 Inga Stotland [this message]
2020-02-07 17:22 ` [PATCH BlueZ] mesh: Allow to finish key refresh when no AppKeys are stored Gix, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200205225343.6271-1-inga.stotland@intel.com \
    --to=inga.stotland@intel.com \
    --cc=brian.gix@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).