From b301a4c43f19c984e9e7232d964dc6212d35e0d6 Mon Sep 17 00:00:00 2001 From: sarveshkumarv3 <86755931+sarveshkumarv3@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:17:09 -0700 Subject: [PATCH] [settings] reset the platform settings file descriptor once closed (#10512) On platform settings deinit, the file descriptor is closed but the variable is not reset, which can lead to calling close on a stale fd leading to bad file descriptor error in case the API is invoked multiple times. --- src/posix/platform/settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/posix/platform/settings.cpp b/src/posix/platform/settings.cpp index 3b4c2fd56..8ef12ffab 100644 --- a/src/posix/platform/settings.cpp +++ b/src/posix/platform/settings.cpp @@ -232,6 +232,7 @@ void otPlatSettingsDeinit(otInstance *aInstance) VerifyOrExit(sSettingsFd != -1); VerifyOrDie(close(sSettingsFd) == 0, OT_EXIT_ERROR_ERRNO); + sSettingsFd = -1; exit: return;