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 2022/03/28 16:19:21 UTC

[incubator-nuttx] branch master updated: fs/files_allocate: assert when fd overflow

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/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 66d8543  fs/files_allocate: assert when fd overflow
66d8543 is described below

commit 66d854371baaf67b06fdd8cd1175baba4db8ec2e
Author: Jiuzhu Dong <do...@xiaomi.com>
AuthorDate: Fri Feb 18 20:28:04 2022 +0800

    fs/files_allocate: assert when fd overflow
    
    Signed-off-by: Jiuzhu Dong <do...@xiaomi.com>
---
 fs/inode/fs_files.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c
index 50ec037..ba31017 100644
--- a/fs/inode/fs_files.c
+++ b/fs/inode/fs_files.c
@@ -98,6 +98,12 @@ static int files_extend(FAR struct filelist *list, size_t row)
 
   list->fl_files = tmp;
   list->fl_rows = row;
+
+  /* Note: If assertion occurs, the fl_rows has a overflow.
+   * And there may be file descriptors leak in system.
+   */
+
+  DEBUGASSERT(list->fl_rows == row);
   return 0;
 }