fs/vfs: fix bug about lost dup oflags in dup2

this issue is caused by commit: b8e30b54ec

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1
2025-07-14 16:39:55 +08:00
committed by Xiang Xiao
parent c51f749f9a
commit ae33447220

View File

@@ -87,9 +87,10 @@ int file_dup2(FAR struct file *filep1, FAR struct file *filep2)
return ret;
}
filep2->f_priv = NULL;
filep2->f_pos = filep1->f_pos;
filep2->f_inode = inode;
filep2->f_oflags = filep1->f_oflags;
filep2->f_priv = NULL;
filep2->f_pos = filep1->f_pos;
filep2->f_inode = inode;
/* Call the open method on the file, driver, mountpoint so that it
* can maintain the correct open counts.