fs: Skip call fs_checkfd if fd < 3 in fs_fdopen

since the stdin, stdout and stderr may initialize later
in userspace if CONFIG_DEV_CONSOLE isn't enabled.
Note: it isn't bigger issue here to skip the check because
vfs will check the validation again in read and write syscall

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-12-15 15:46:40 +08:00 committed by Masayuki Ishikawa
parent e1596e80aa
commit 29c6f11239

View File

@ -115,7 +115,7 @@ int fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb,
{
FAR struct streamlist *slist;
FAR FILE *stream;
int ret;
int ret = OK;
/* Check input parameters */
@ -164,7 +164,7 @@ int fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb,
* more checks.
*/
else
else if (fd >= 3)
{
ret = fs_checkfd(tcb, fd, oflags);
}