hujun260 commented on code in PR #9496:
URL: https://github.com/apache/nuttx/pull/9496#discussion_r1224168579


##########
fs/inode/fs_files.c:
##########
@@ -525,6 +525,11 @@ int nx_dup2_from_tcb(FAR struct tcb_s *tcb, int fd1, int 
fd2)
   ret = file_dup2(&list->fl_files[fd1 / CONFIG_NFILE_DESCRIPTORS_PER_BLOCK]
                                  [fd1 % CONFIG_NFILE_DESCRIPTORS_PER_BLOCK],
                   filep);
+
+#ifdef CONFIG_FDSAN
+  filep->f_tag = file.f_tag;

Review Comment:
   @xiaoxiang781216 
   Freopen will call dup2 and dup2 is also an API for the user layer. 
   If we only modify freopen's implementation, users will still encounter 
errors when using dup2 directly.
   
   Fdsan can be actively or passively used by users.
   If the user passively uses fdsan. we do not expect that dup2 will change 
f_tag.
   If the user actively uses fdsan, they will actively call the fdsan API to 
change the f_tag.



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

Reply via email to