소스 검색

[libc]fix bug of _isatty_r()

Meco Man 4 년 전
부모
커밋
20b95b8af5
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      components/libc/compilers/newlib/syscalls.c

+ 7 - 4
components/libc/compilers/newlib/syscalls.c

@@ -8,6 +8,7 @@
  * 2021-02-11     Meco Man     remove _gettimeofday_r() and _times_r()
  * 2020-02-13     Meco Man     re-implement exit() and abort()
  * 2020-02-21     Meco Man     improve and beautify syscalls
+ * 2020-02-24     Meco Man     fix bug of _isatty_r()
  */
 
 #include <reent.h>
@@ -89,12 +90,14 @@ int
 _isatty_r(struct _reent *ptr, int fd)
 {
     if (fd >=0 && fd < 3)
+    {
         return 1;
-
-    ptr->_errno = ENOTTY ;
-    return 0;
+    }
+    else
+    {
+        return 0;
+    }
 }
-
 int
 _kill_r(struct _reent *ptr, int pid, int sig)
 {