You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/01/20 14:04:59 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #2724: fs/tmpfs: Iterate the entry reversely in readdir

xiaoxiang781216 opened a new pull request #2724:
URL: https://github.com/apache/incubator-nuttx/pull/2724


   ## Summary
   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);
           }
       }
   }
   ```
   
   ## Impact
   tmpfs
   
   ## Testing
   All child can be removed by the above code.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis merged pull request #2724: fs/tmpfs: Iterate the entry reversely in readdir

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #2724:
URL: https://github.com/apache/incubator-nuttx/pull/2724


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis merged pull request #2724: fs/tmpfs: Iterate the entry reversely in readdir

Posted by GitBox <gi...@apache.org>.
acassis merged pull request #2724:
URL: https://github.com/apache/incubator-nuttx/pull/2724


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org