diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index a3ba57a280..7d8ec2e8b4 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -152,8 +152,8 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode) #ifdef RT_USING_POSIX if (libc_stdio_get_console() < 0) { - LOG_E("invoke standard output before initializing libc"); - return -1; + LOG_W("Do not invoke standard output before initializing libc"); + return 0; } size = read(STDIN_FILENO, buf, len); return len - size; @@ -197,8 +197,8 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode) #ifdef RT_USING_POSIX if (libc_stdio_get_console() < 0) { - LOG_E("invoke standard input before initializing libc"); - return -1; + LOG_W("Do not invoke standard input before initializing libc"); + return 0; } size = write(STDOUT_FILENO, buf, len); return len - size; diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c index bdc694b7d8..ae980be6ca 100644 --- a/components/libc/compilers/dlib/syscall_read.c +++ b/components/libc/compilers/dlib/syscall_read.c @@ -31,8 +31,8 @@ size_t __read(int handle, unsigned char *buf, size_t len) #ifdef RT_USING_POSIX if (libc_stdio_get_console() < 0) { - LOG_E("invoke standard input before initializing libc"); - return _LLIO_ERROR; + LOG_W("Do not invoke standard input before initializing libc"); + return 0; } return read(STDIN_FILENO, buf, len); #else diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c index bd7cc83d99..ffee51882d 100644 --- a/components/libc/compilers/dlib/syscall_write.c +++ b/components/libc/compilers/dlib/syscall_write.c @@ -36,8 +36,8 @@ size_t __write(int handle, const unsigned char *buf, size_t len) #ifdef RT_USING_POSIX if (libc_stdio_get_console() < 0) { - LOG_E("invoke standard output before initializing libc"); - return _LLIO_ERROR; + LOG_W("Do not invoke standard output before initializing libc"); + return 0; } return write(STDOUT_FILENO, (void*)buf, len); #else diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index 1cb7475fe1..4c1dc82ad3 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -227,8 +227,8 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes) _ssize_t rc; if (libc_stdio_get_console() < 0 && fd == STDIN_FILENO) { - LOG_E("invoke standard input before initializing libc"); - return -1; + LOG_W("Do not invoke standard input before initializing libc"); + return 0; } rc = read(fd, buf, nbytes); return rc; @@ -303,8 +303,8 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) _ssize_t rc; if (libc_stdio_get_console() < 0 && fd == STDOUT_FILENO) { - LOG_E("invoke standard output before initializing libc"); - return -1; + LOG_W("Do not invoke standard output before initializing libc"); + return 0; } rc = write(fd, buf, nbytes); return rc;