Explorar o código

Merge pull request #5161 from mysterywolf/libc

[libc][keil] remove libc_stdio_read() in __MICROLIB
guo %!s(int64=3) %!d(string=hai) anos
pai
achega
0211f2fcc1
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      components/libc/compilers/armlibc/syscalls.c

+ 7 - 1
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