mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-02 05:20:01 +08:00
fix 'mem spiffs view' and bad file stats retrieval
This commit is contained in:
parent
bf49f4432b
commit
1b2091932e
2 changed files with 10 additions and 8 deletions
|
@ -208,15 +208,12 @@ static void remove_from_spiffs(const char *filename) {
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
static spiffs_stat stat_in_spiffs(const char *filename) {
|
|
||||||
spiffs_stat s;
|
|
||||||
if (SPIFFS_stat(&fs, filename, &s) < 0)
|
|
||||||
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t size_in_spiffs(const char *filename) {
|
uint32_t size_in_spiffs(const char *filename) {
|
||||||
spiffs_stat s = stat_in_spiffs(filename);
|
spiffs_stat s;
|
||||||
|
if (SPIFFS_stat(&fs, filename, &s) < 0) {
|
||||||
|
Dbprintf("errno %i\n", SPIFFS_errno(&fs));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return s.size;
|
return s.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -497,6 +497,11 @@ static int CmdFlashMemSpiFFSView(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t len = resp.data.asDwords[0];
|
uint32_t len = resp.data.asDwords[0];
|
||||||
|
if (len == 0) {
|
||||||
|
PrintAndLogEx(ERR, "error, failed to retrieve file stats on SPIFFSS");
|
||||||
|
return PM3_EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *dump = calloc(len, sizeof(uint8_t));
|
uint8_t *dump = calloc(len, sizeof(uint8_t));
|
||||||
if (!dump) {
|
if (!dump) {
|
||||||
PrintAndLogEx(ERR, "error, cannot allocate memory ");
|
PrintAndLogEx(ERR, "error, cannot allocate memory ");
|
||||||
|
|
Loading…
Reference in a new issue