mirror of
https://github.com/apache/nuttx.git
synced 2026-08-05 22:29:02 +00:00
to avoid readdir return the wrong entry in the following code:
void rmdir_recursive(FAR const char *path)
{
FAR DIR *dir = opendir(path);
while (1)
{
char fullpath[MAX_PATH];
FAR dirent *ent = readdir(dir);
if (ent == NULL)
{
break;
}
sprintf(fullpath, "%s/%s", path, ent->d_name);
if (DIRENT_ISDIRECTORY(ent->d_type))
{
rmdir_recursive(fullpath);
}
else
{
unlink(fullpath);
}
}
}
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ide60fe8db6aada88ad3d8e45367f11599a6f33b1
|
||
|---|---|---|
| .. | ||
| fs_tmpfs.c | ||
| fs_tmpfs.h | ||
| Kconfig | ||
| Make.defs | ||