Fix swap files.

When a dynamic file is deleted, all scoped references to other dynamic files are invalidated.

Fixes #124

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2025-03-19 13:33:35 +01:00
parent eacb8a040c
commit 49c0179ccf

View File

@@ -443,6 +443,8 @@ int cmd_otp() {
} }
else { else {
delete_file(ef1); delete_file(ef1);
// When a dynamic file is deleted, existing referenes are invalidated
ef2 = file_new(EF_OTP_SLOT2);
} }
if (ef1_data) { if (ef1_data) {
file_put_data(ef2, tmp, sizeof(tmp)); file_put_data(ef2, tmp, sizeof(tmp));