From 9f51c47c10b30ded5845f2c475879c3c142157c8 Mon Sep 17 00:00:00 2001 From: ligd Date: Thu, 7 Dec 2023 17:09:08 +0800 Subject: [PATCH] fs: remove un-useful memcpy() in nx_close_from_tcb() Signed-off-by: ligd --- fs/inode/fs_files.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c index f1ebf7c885..a574a6e79a 100644 --- a/fs/inode/fs_files.c +++ b/fs/inode/fs_files.c @@ -712,7 +712,6 @@ int dup3(int fd1, int fd2, int flags) int nx_close_from_tcb(FAR struct tcb_s *tcb, int fd) { FAR struct file *filep; - FAR struct file file; FAR struct filelist *list; #ifdef CONFIG_FDCHECK @@ -737,10 +736,7 @@ int nx_close_from_tcb(FAR struct tcb_s *tcb, int fd) return -EBADF; } - memcpy(&file, filep, sizeof(struct file)); - memset(filep, 0, sizeof(struct file)); - - return file_close(&file); + return file_close(filep); } /****************************************************************************