Copilot commented on code in PR #19179:
URL: https://github.com/apache/nuttx/pull/19179#discussion_r3446592699
##########
fs/vfs/fs_dir.c:
##########
@@ -376,6 +376,8 @@ static int read_pseudodir(FAR struct fs_dirent_s *dir,
entry->d_type = DTYPE_DIRECTORY;
}
+ entry->d_ino = next->i_ino;
+
Review Comment:
`read_pseudodir()` assigns `entry->d_ino = next->i_ino`, but `next` is not
defined in this function. This will not compile and should use the current
inode (`pdir->next`).
##########
fs/vfs/fs_dir.c:
##########
@@ -425,40 +426,19 @@ static int dir_close(FAR struct file *filep)
if (INODE_IS_MOUNTPT(inode))
{
- /* The node is a file system mointpoint. Verify that the
- * mountpoint supports the closedir() method (not an error if it
- * does not)
- */
-
- if (inode->u.i_mops->closedir != NULL)
- {
- ret = inode->u.i_mops->closedir(inode, dir);
- }
+ close_mountpoint(inode, dir);
}
else
#endif
{
- FAR struct fs_pseudodir_s *pdir = filep->f_priv;
-
- /* The node is part of the root pseudo file system, release
- * our contained reference to the 'next' inode.
- */
-
- if (pdir->next != NULL)
- {
- inode_release(pdir->next);
- }
-
- /* Then release the container */
-
- fs_heap_free(dir);
+ close_pseudodir(dir);
}
/* Release our references on the contained 'root' inode */
inode_release(inode);
fs_heap_free(relpath);
- return ret;
+ return OK;
Review Comment:
`dir_close()` now calls `close_mountpoint()` / `close_pseudodir()`, but
those symbols are not defined anywhere in-tree (only referenced here). This
will fail to link, and the current change also drops the previous `closedir()`
error propagation by unconditionally returning `OK`. Either add real helper
implementations or keep the original inline close logic and return the actual
status.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]