From b6c2368bef902562e1572393285cbd1335710565 Mon Sep 17 00:00:00 2001
From: Meco Man <920369182@qq.com>
Date: Tue, 12 Oct 2021 23:06:19 -0400
Subject: [PATCH] [libc][keil] remove libc_stdio_read() in __MICROLIB

---
 components/libc/compilers/armlibc/syscalls.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c
index 3b1627d82a..ccdcfc86ea 100644
--- a/components/libc/compilers/armlibc/syscalls.c
+++ b/components/libc/compilers/armlibc/syscalls.c
@@ -336,7 +336,13 @@ int fgetc(FILE *f)
 #ifdef RT_USING_POSIX
     char ch;
 
-    if (libc_stdio_read(&ch, 1) == 1)
+    if (libc_stdio_get_console() < 0)
+    {
+        LOG_W("Do not invoke standard output before initializing libc");
+        return -1;
+    }
+
+    if(read(STDIN_FILENO, &ch, 1) == 1)
         return ch;
 #endif