diff --git a/fs/vfs/fs_dup2.c b/fs/vfs/fs_dup2.c index 62d4e267d6..501bcd56b5 100644 --- a/fs/vfs/fs_dup2.c +++ b/fs/vfs/fs_dup2.c @@ -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.