diff options
| author | Bernard Xiong <[email protected]> | 2018-09-21 17:09:46 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-09-21 17:09:46 +0800 |
| commit | b5202d17fbd8e226a737caa38d536a4cd7a55956 (patch) | |
| tree | 4df28e82517bc51eb2208933e54848560def5982 /components/libc/compilers | |
| parent | f7423741f2868cca2a64619a0907668acf02bd5d (diff) | |
| parent | b611f317fe83aa262879a07d77c8102434d3b847 (diff) | |
Merge branch 'master' into dev
Diffstat (limited to 'components/libc/compilers')
| -rw-r--r-- | components/libc/compilers/armlibc/stdio.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/components/libc/compilers/armlibc/stdio.c b/components/libc/compilers/armlibc/stdio.c index d1ac976568..9d90823c78 100644 --- a/components/libc/compilers/armlibc/stdio.c +++ b/components/libc/compilers/armlibc/stdio.c @@ -65,11 +65,27 @@ int libc_stdio_get_console(void) int libc_stdio_read(void *buffer, size_t size) { - return read(std_fd, buffer, size); + if (std_fd >= 0) + { + return read(std_fd, buffer, size); + } + else + { + rt_kprintf("Illegal stdio input!\n"); + return 0; + } } int libc_stdio_write(const void *buffer, size_t size) { - return write(std_fd, buffer, size); + if (std_fd >= 0) + { + return write(std_fd, buffer, size); + } + else + { + rt_kprintf("Illegal stdio output!\n"); + return size; + } } #endif |
