summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-02-26 00:48:58 +0800
committerGitHub <[email protected]>2021-02-26 00:48:58 +0800
commitfae0fa8eea4c0e797940bf1eddc8ee6c1711734a (patch)
tree14b2a53bd94e8d30dbf274e8233e35c11faa7c23
parent4f6fea18c6dce1cfc31fed14b54aabb201ed24c7 (diff)
parent20b95b8af54dc4be1012f9b395873c2577a2373e (diff)
Merge pull request #4383 from mysterywolf/istty
[libc]fix bug of _isatty_r()
-rw-r--r--components/libc/compilers/newlib/syscalls.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c
index 45aa4a34de..949d8a61de 100644
--- a/components/libc/compilers/newlib/syscalls.c
+++ b/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)
{