mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-11 01:38:26 +02:00
Delete meta file if becomes zero.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -353,6 +353,9 @@ int meta_delete(uint16_t fid) {
|
|||||||
uint16_t cfid = (tag_data[0] << 8 | tag_data[1]);
|
uint16_t cfid = (tag_data[0] << 8 | tag_data[1]);
|
||||||
if (cfid == fid) {
|
if (cfid == fid) {
|
||||||
size_t new_len = data_len-1-tag_len-format_tlv_len(tag_len, NULL);
|
size_t new_len = data_len-1-tag_len-format_tlv_len(tag_len, NULL);
|
||||||
|
if (new_len == 0)
|
||||||
|
flash_clear_file(ef);
|
||||||
|
else {
|
||||||
fdata = (uint8_t *)calloc(1, new_len);
|
fdata = (uint8_t *)calloc(1, new_len);
|
||||||
if (tpos > data) {
|
if (tpos > data) {
|
||||||
memcpy(fdata, data, tpos-data);
|
memcpy(fdata, data, tpos-data);
|
||||||
@@ -364,6 +367,7 @@ int meta_delete(uint16_t fid) {
|
|||||||
free(fdata);
|
free(fdata);
|
||||||
if (r != CCID_OK)
|
if (r != CCID_OK)
|
||||||
return CCID_EXEC_ERROR;
|
return CCID_EXEC_ERROR;
|
||||||
|
}
|
||||||
low_flash_available();
|
low_flash_available();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user