Merge pull request #1824 from yangfasheng/master

update armlibc/stdio.c
This commit is contained in:
Bernard Xiong 2018-09-18 18:38:57 +08:00 committed by GitHub
commit ef4f904096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 2 deletions

View File

@ -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