mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-12-26 09:08:25 +00:00
[libc] Fix the O_CREAT issue.
libc_stdio_set_console/newlib uses fopen to open console device, which has O_CREAT flag and cause fault.
This commit is contained in:
@@ -81,7 +81,9 @@ int libc_stdio_set_console(const char* device_name, int mode)
|
||||
_GLOBAL_REENT->__sdidinit = 1;
|
||||
}
|
||||
|
||||
return fileno(std_console);
|
||||
if (std_console) return fileno(std_console);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int libc_stdio_get_console(void) {
|
||||
|
||||
Reference in New Issue
Block a user