fs:add _POSIX_OPEN_MAX limit to files_extend

Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
tianxin7 2021-09-02 14:46:31 +08:00 committed by Xiang Xiao
parent 0460367a70
commit b53bbb15c5
1 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,11 @@ static int files_extend(FAR struct filelist *list, size_t row)
return 0;
}
if (row * CONFIG_NFILE_DESCRIPTORS_PER_BLOCK > _POSIX_OPEN_MAX)
{
return -EMFILE;
}
tmp = kmm_realloc(list->fl_files, sizeof(FAR struct file *) * row);
DEBUGASSERT(tmp);
if (tmp == NULL)