From 11751d60e0912a944803a8c593cc88e9819fab2e Mon Sep 17 00:00:00 2001 From: gztss <2269610337@qq.com> Date: Thu, 24 Jan 2019 09:05:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=5Fsys=5Fflen()=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/stubs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index 820daeff39..555108f712 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)