pussuw commented on code in PR #16361: URL: https://github.com/apache/nuttx/pull/16361#discussion_r2095515021
########## fs/vfs/fs_dup.c: ########## @@ -65,29 +65,32 @@ int file_dup(FAR struct file *filep, int minfd, int flags) uint8_t f_tag_fdcheck; /* File owner fdcheck tag, init to 0 */ #endif - fd2 = file_allocate(g_root_inode, 0, 0, NULL, minfd, true); + /* Pass the close on exec flag to file_allocate */ + + fd2 = file_allocate(g_root_inode, flags, 0, NULL, minfd, true); if (fd2 < 0) { return fd2; } ret = fs_getfilep(fd2, &filep2); #ifdef CONFIG_FDSAN - f_tag_fdsan = filep2->f_tag_fdsan; + f_tag_fdsan = nx_fcntl(fd2, NX_GETTAG_FDSAN, 0); Review Comment: @xiaoxiang781216 should I remove these calls for fdsan/fdcheck. I think they are redundant. - file_allocate initializes fdsan & fdcheck to 0 for fd2 - reading the value here for fd2 will return 0 every time - writing back 0 after file_dup2 is redundant as file_dup2 does not modify fdsan/fdcheck values I left the old implementation as is, even though I think it could be removed. What's your opinion ? -- 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