SPIFFS causes crashes if you attempt to rmdir. Since there are no true directories in spiffs, this ought to be a noop. It looks like @me-no-dev worked around this by using unlink instead of rmdir, which works in fatfs and doesn't panic spiffs. This behavior is not universal. In order to get littlefs working, it would be good to get this back to conformity. Rather than digging deep into the upstream spiffs, I just check the mountpoint and noop if it is "/spiffs". So, if the user has changed the mountpoint, this will not work, but I think it's a pretty good tradeoff.
This commit is contained in:
parent
93d850f783
commit
882b12c44e
@ -184,6 +184,11 @@ bool VFSImpl::rmdir(const char *path)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(_mountpoint, "/spiffs") == 0) {
|
||||
log_e("rmdir is unnecessary in SPIFFS");
|
||||
return false;
|
||||
}
|
||||
|
||||
VFSFileImpl f(this, path, "r");
|
||||
if(!f || !f.isDirectory()) {
|
||||
if(f) {
|
||||
@ -200,7 +205,7 @@ bool VFSImpl::rmdir(const char *path)
|
||||
return false;
|
||||
}
|
||||
sprintf(temp,"%s%s", _mountpoint, path);
|
||||
auto rc = unlink(temp);
|
||||
auto rc = ::rmdir(temp);
|
||||
free(temp);
|
||||
return rc == 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user