From 35ff86ed00102a1e429f6583cbdf53abaa30e465 Mon Sep 17 00:00:00 2001 From: Inga Stotland Date: Wed, 5 Feb 2020 14:53:43 -0800 Subject: [PATCH] mesh: Allow to finish key refresh when no AppKeys are stored 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. Change-Id: I1ca58e5b4f06acf8ef17e8eb0ac0afa3f7decd70 Signed-off-by: Anupam Roy --- mesh/keyring.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mesh/keyring.c b/mesh/keyring.c index 3eccf7e..d7bb405 100644 --- a/mesh/keyring.c +++ b/mesh/keyring.c @@ -26,9 +26,9 @@ #endif #include #include +#include #include #include -#include #include @@ -167,7 +167,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.7.4