summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2020-08-05 11:37:54 +0800
committerGitHub <[email protected]>2020-08-05 11:37:54 +0800
commitff28345954610e74e09ebebbbdbb4682ae360454 (patch)
tree495fe6388e74bbe3f8879c0dd33deb2a5e7d31a6 /components
parentd1355e3027b33dc5e2cf58e2c4e753dd772ea2da (diff)
parent576475f14f66e3bc73fcef434ca51bb37420d49d (diff)
Merge pull request #3803 from mysterywolf/master
[fixed]增加条件编译,防止RT_USING_DFS没有定义时 _sys_flen()出现编译警告:stat变量定义但没有被调用 的问题
Diffstat (limited to 'components')
-rw-r--r--components/libc/compilers/armlibc/stubs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c
index b6ffb37b0f..b4cc13799e 100644
--- a/components/libc/compilers/armlibc/stubs.c
+++ b/components/libc/compilers/armlibc/stubs.c
@@ -9,6 +9,8 @@
* 2013-11-24 aozima fixed _sys_read()/_sys_write() issues.
* 2014-08-03 bernard If using msh, use system() implementation
* in msh.
+ * 2020-08-05 Meco Man fixed _sys_flen() compiling-warning when
+ * RT_USING_DFS is not defined
*/
#include <string.h>
@@ -265,16 +267,16 @@ RT_WEAK void _sys_exit(int return_code)
*/
long _sys_flen(FILEHANDLE fh)
{
+#ifdef RT_USING_DFS
struct stat stat;
-
+
if (fh < STDERR)
return -1;
-#ifndef RT_USING_DFS
- return -1;
-#else
fstat(fh, &stat);
return stat.st_size;
+#else
+ return -1;
#endif
}