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 sched/: Make more naming consistent 2020-05-17 14:01:00 -03:00
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 fs/fat/fs_fat32util.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
hostfs Fix some typos in comments 2020-11-08 18:58:20 +01:00
inode fs: Remove fs_dupfd and fs_dupfd2 internal functions 2021-01-13 17:40:52 +08:00
littlefs Update littlefs/libcxx/openamp Make.defs since source code used 2020-11-09 20:55:03 +08:00
mmap fs/mmap/fs_mmap.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
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 Change all 'Nuttx' to 'NuttX' 2020-10-20 01:45:06 -07:00
nxffs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
partition Change all files come from Xiaomi/Pinecone to Apache License 2.0 2020-08-22 17:37:21 -06:00
procfs fs/readdir: Must reserve a byte for the NUL terminator 2021-01-18 16:04:34 +08:00
romfs fs/romfs/fs_romfsutil.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
semaphore Check return from nxsem_wait_initialize() 2020-03-30 17:09:45 +01:00
shm fs/: Remove dangling space at the end of lines. 2017-06-28 13:17:55 -06:00
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 fix nxstyle warning 2020-07-10 21:30:02 +01:00
vfs fs: Remove fs_dupfd and fs_dupfd2 internal functions 2021-01-13 17:40:52 +08:00
fs_initialize.c Remove some block comments before empty code sections 2016-04-11 18:16:04 -06:00
Kconfig vfs/epoll: add epoll_create1(2) implement 2020-08-17 23:41:13 -05:00
Makefile style/Makefile: remove unnecessary trailing whitespace 2020-11-30 11:20:05 +08:00