mirror of
https://github.com/espressif/openthread.git
synced 2026-10-01 21:37:39 +00:00
[posix] use default when passing nullptr to SettingsFile::SetSettingsPath (#12268)
This commit adds the nullptr check in `SettingsFile::SetSettingsPath`. If the nullptr is passed to `SettingsFile::SetSettingsPath`, it will set the settings path to a default path (OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH).
This commit is contained in:
@@ -56,7 +56,8 @@ char SettingsFile::sSettingsPath[] = OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH;
|
|||||||
const char *SettingsFile::GetSettingsPath(void) { return sSettingsPath; }
|
const char *SettingsFile::GetSettingsPath(void) { return sSettingsPath; }
|
||||||
void SettingsFile::SetSettingsPath(const char *aSettingsPath)
|
void SettingsFile::SetSettingsPath(const char *aSettingsPath)
|
||||||
{
|
{
|
||||||
snprintf(sSettingsPath, sizeof(sSettingsPath), "%s", aSettingsPath);
|
snprintf(sSettingsPath, sizeof(sSettingsPath), "%s",
|
||||||
|
aSettingsPath == nullptr ? OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH : aSettingsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
otError SettingsFile::Init(const char *aSettingsFileBaseName)
|
otError SettingsFile::Init(const char *aSettingsFileBaseName)
|
||||||
|
|||||||
Reference in New Issue
Block a user