Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 882b12c

Browse filesBrowse files
authored
rmdir causes issues in SPIFFS. Fixes espressif#4138, albeit not very cleanly (espressif#4154)
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.
1 parent 93d850f commit 882b12c
Copy full SHA for 882b12c

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎libraries/FS/src/vfs_api.cpp

Copy file name to clipboardExpand all lines: libraries/FS/src/vfs_api.cpp
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ bool VFSImpl::rmdir(const char *path)
184184
return false;
185185
}
186186

187+
if (strcmp(_mountpoint, "/spiffs") == 0) {
188+
log_e("rmdir is unnecessary in SPIFFS");
189+
return false;
190+
}
191+
187192
VFSFileImpl f(this, path, "r");
188193
if(!f || !f.isDirectory()) {
189194
if(f) {
@@ -200,7 +205,7 @@ bool VFSImpl::rmdir(const char *path)
200205
return false;
201206
}
202207
sprintf(temp,"%s%s", _mountpoint, path);
203-
auto rc = unlink(temp);
208+
auto rc = ::rmdir(temp);
204209
free(temp);
205210
return rc == 0;
206211
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.