nuttx/fs
Xiang Xiao abebd91725 fs/tmpfs: Iterate the entry reversely in readdir
MIRTOS-342

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
2021-01-20 21:57:31 +08:00
..
aio
binfs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
cromfs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
dirent fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
driver fs: Reimplement file_open to not depend on nx_open 2021-01-12 11:03:20 +08:00
fat
hostfs
inode fs: Remove fs_dupfd and fs_dupfd2 internal functions 2021-01-13 17:40:52 +08:00
littlefs
mmap
mount fs/mount: fix mount cmd break out when meet stat error 2021-01-11 14:05:24 +08:00
mqueue mqueue: add poll support 2021-01-12 10:34:43 +08:00
nfs
nxffs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
partition
procfs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
romfs
semaphore
shm
smartfs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
spiffs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
tmpfs fs/tmpfs: Iterate the entry reversely in readdir 2021-01-20 21:57:31 +08:00
unionfs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
userfs
vfs fs: Remove fs_dupfd and fs_dupfd2 internal functions 2021-01-13 17:40:52 +08:00
fs_initialize.c
Kconfig
Makefile