浏览代码

[libc] Fix the printf issue when disable DFS

Bernard Xiong 6 年之前
父节点
当前提交
38c49099c9
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      components/libc/compilers/newlib/syscalls.c

+ 3 - 1
components/libc/compilers/newlib/syscalls.c

@@ -9,6 +9,8 @@
 #include <reent.h>
 #include <sys/errno.h>
 #include <sys/time.h>
+#include <stdio.h>
+
 #include <rtthread.h>
 
 #ifdef RT_USING_DFS
@@ -218,7 +220,7 @@ _ssize_t
 _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
 {
 #ifndef RT_USING_DFS
-    if (fd == 0)
+    if (fileno(stdout) == fd)
     {
         rt_device_t console;