mirror of
https://github.com/espressif/openthread.git
synced 2026-08-10 20:57:47 +00:00
[settings] do not assert when SettingsFd is -1 in Deinit (#7170)
We added a dry run option. So it is possible that the settings fd is -1 when de-initialization. The assert here makes the program crash. This commit updates it to a `VerifyOrExit` to avoid crashing.
This commit is contained in:
@@ -226,8 +226,11 @@ void otPlatSettingsDeinit(otInstance *aInstance)
|
||||
otPosixSecureSettingsDeinit(aInstance);
|
||||
#endif
|
||||
|
||||
assert(sSettingsFd != -1);
|
||||
VerifyOrExit(sSettingsFd != -1);
|
||||
VerifyOrDie(close(sSettingsFd) == 0, OT_EXIT_ERROR_ERRNO);
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
|
||||
|
||||
Reference in New Issue
Block a user