This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 02628deb55 libc/fdsan: keep f_tag unchanged
02628deb55 is described below
commit 02628deb55b19a36049cad2e7b6469b4cb442351
Author: hujun5 <[email protected]>
AuthorDate: Thu Jun 8 18:43:40 2023 +0800
libc/fdsan: keep f_tag unchanged
When the file pointer is reopened, keep f_tag unchanged as fd remains
unchanged
fix issue https://github.com/apache/nuttx/issues/9494
Signed-off-by: hujun5 <[email protected]>
---
fs/inode/fs_files.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c
index 8db30136f2..e75cd91019 100644
--- a/fs/inode/fs_files.c
+++ b/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;
+#endif
+
nxmutex_unlock(&list->fl_lock);
file_close(&file);