diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index 820daeff392f787d99849df29b87794013824249..555108f712ad7f0c38b78a0804b84973ac45e78a 100644 --- a/components/libc/compilers/armlibc/stubs.c +++ b/components/libc/compilers/armlibc/stubs.c @@ -265,7 +265,17 @@ void _sys_exit(int return_code) */ long _sys_flen(FILEHANDLE fh) { + struct stat stat; + + if (fh < STDERR) + return -1; + +#ifndef RT_USING_DFS return -1; +#else + fstat(fh, &stat); + return stat.st_size; +#endif } int _sys_istty(FILEHANDLE fh)