diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index a3ba57a28050caf45170dc473e711d2f08f911c4..7d8ec2e8b44e5e0501aa2daf9cf5512f5a47e0c6 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 bdc694b7d8fb1e180ec927dbcc68b91dd976cdf6..ae980be6ca08d132d3fca24129829e167816b7ce 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 bd7cc83d999871a130978fa8904800dacf54eff8..ffee51882d405bc5fd22dbd499c318c4dae3e21e 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 1cb7475fe1b3d0be2f0a03f1312ef5f80f531cb5..4c1dc82ad376313b69e20b59d9009dcf0e6bf673 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;