acassis commented on code in PR #7317:
URL: https://github.com/apache/incubator-nuttx/pull/7317#discussion_r996324092


##########
fs/vfs/fs_rename.c:
##########
@@ -90,7 +90,7 @@ static int pseudorename(FAR const char *oldpath, FAR struct 
inode *oldinode,
         {
           inode_release(newinode);
           ret = OK;
-          goto errout; /* Bad naming, this is not an error case. */
+          goto errout; /* Same name, this is not an error case. */

Review Comment:
   Should it be considered an error? At least on Linux when trying to move a 
directory to itself we see an error reported:
   ```
   $ mv a a
   mv: cannot move 'a' to a subdirectory of itself, 'a/a'
   ```



##########
fs/vfs/fs_rename.c:
##########
@@ -111,26 +111,21 @@ static int pseudorename(FAR const char *oldpath, FAR 
struct inode *oldinode,
       if (newinode->u.i_ops == NULL || newinode->i_child != NULL)
         {
           FAR char *subdirname;
-          FAR char *tmp;
 
           inode_release(newinode);
+          if (subdir != NULL)
+            {
+              kmm_free(subdir);
+              subdir = NULL;
+            }

Review Comment:
   Please include a comment above, your modification simplified the silly test 
below, but for someone reading this code these things are difficult to 
figure-out initially, this is a loop function.



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

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

Reply via email to