diff options
| author | Bernard Xiong <[email protected]> | 2018-09-18 18:38:57 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-09-18 18:38:57 +0800 |
| commit | ef4f904096681dc7726fafc0734fca7f6b6b20c0 (patch) | |
| tree | 4eedefabe538e2d28bd1c4fa2c1366951db57869 | |
| parent | 6de7be2693c479fc9bdf1fecfe5566567744edc8 (diff) | |
| parent | f31b11de78b8d5c9940dac3ce233ecbf51027c16 (diff) | |
Merge pull request #1824 from yangfasheng/master
update armlibc/stdio.c
| -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 |
