Copilot commented on code in PR #21685:
URL: https://github.com/apache/nuttx/pull/21685#discussion_r4535556558
##########
fs/vfs/fs_dir.c:
##########
@@ -509,6 +509,9 @@ static ssize_t dir_read(FAR struct file *filep, FAR char
*buffer,
/* The node is part of the root pseudo file system */
ret = read_pseudodir(dir, (FAR struct dirent *)buffer);
+#ifdef CONFIG_PSEUDOFS_ATTRIBUTES
+ nxclock_gettime(CLOCK_REALTIME, &dir->fd_root->i_atime);
Review Comment:
`i_atime` is updated unconditionally even when `read_pseudodir()` fails
(i.e., `ret < 0` due to an actual error). That can incorrectly report an access
time update on failed reads. Consider updating `i_atime` only if `ret`
indicates a successful read (and optionally also for the `-ENOENT` EOF case if
you want to treat reaching end-of-directory as an access). Also consider
checking the return value of `nxclock_gettime()` before overwriting `i_atime`.
--
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]