You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/03/07 01:08:58 UTC

(nuttx) 04/05: fs: remove un-useful memcpy() in nx_close_from_tcb()

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

commit 9f51c47c10b30ded5845f2c475879c3c142157c8
Author: ligd <li...@xiaomi.com>
AuthorDate: Thu Dec 7 17:09:08 2023 +0800

    fs: remove un-useful memcpy() in nx_close_from_tcb()
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 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);
 }
 
 /****************************************************************************