pussuw commented on code in PR #16361: URL: https://github.com/apache/nuttx/pull/16361#discussion_r2085178083
########## fs/vfs/fs_dup.c: ########## @@ -73,21 +73,28 @@ int file_dup(FAR struct file *filep, int minfd, int flags) ret = fs_getfilep(fd2, &filep2); #ifdef CONFIG_FDSAN - f_tag_fdsan = filep2->f_tag_fdsan; + f_tag_fdsan = fs_fdcntl(fd2, FIOC_GETTAG_FDSAN, 0); #endif #ifdef CONFIG_FDCHECK - f_tag_fdcheck = filep2->f_tag_fdcheck; + f_tag_fdcheck = fs_fdcntl(fd2, FIOC_GETTAG_FDCHECK, 0); #endif DEBUGASSERT(ret >= 0); - ret = file_dup3(filep, filep2, flags); + ret = file_dup2(filep, filep2); + if (ret >= 0 && flags != 0) Review Comment: The only expected flag here is O_CLOEXEC, so this and the flags == O_CLOEXEC test below are as correct as testing for a bitmask. I though it is more clear this way, the caller sees immediately that other flags are not allowed. -- 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