mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/nvs: clear handles list on init, fix returning *length in nvs_get_{str,blob}
This commit is contained in:
parent
35d50643bc
commit
7447d08605
@ -56,6 +56,7 @@ extern "C" esp_err_t nvs_flash_init(uint32_t baseSector, uint32_t sectorCount)
|
|||||||
Lock::init();
|
Lock::init();
|
||||||
Lock lock;
|
Lock lock;
|
||||||
NVS_DEBUGV("%s %d %d\r\n", __func__, baseSector, sectorCount);
|
NVS_DEBUGV("%s %d %d\r\n", __func__, baseSector, sectorCount);
|
||||||
|
s_nvs_handles.clear();
|
||||||
return s_nvs_storage.init(baseSector, sectorCount);
|
return s_nvs_storage.init(baseSector, sectorCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,12 +261,15 @@ static esp_err_t nvs_get_str_or_blob(nvs_handle handle, nvs::ItemType type, cons
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length != nullptr && out_value == nullptr) {
|
if (length == nullptr) {
|
||||||
|
return ESP_ERR_NVS_INVALID_LENGTH;
|
||||||
|
}
|
||||||
|
else if (out_value == nullptr) {
|
||||||
*length = dataSize;
|
*length = dataSize;
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
else if (*length < dataSize) {
|
||||||
if (length == nullptr || *length < dataSize) {
|
*length = dataSize;
|
||||||
return ESP_ERR_NVS_INVALID_LENGTH;
|
return ESP_ERR_NVS_INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user