diff options
| author | Bernard Xiong <[email protected]> | 2018-02-11 14:39:22 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-02-11 14:39:22 +0800 |
| commit | 2e71b8a741000c0ccf9852933a2a1bf65eb607dd (patch) | |
| tree | 04ec29c04891be9e8bab88d8ea33e2ccda52418b /components/libc | |
| parent | 915ba043af321f042314cfd9cd6ab39f69b16ed4 (diff) | |
| parent | 43cc01742fc5cce22ccd2037ba80216c5207fc6a (diff) | |
Merge pull request #1221 from BernardXiong/master
merge O_CREAT issue
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/compilers/dlib/libc.c | 5 | ||||
| -rw-r--r-- | components/libc/compilers/newlib/stdio.c | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c index fe219537e3..fa977ab399 100644 --- a/components/libc/compilers/dlib/libc.c +++ b/components/libc/compilers/dlib/libc.c @@ -36,7 +36,7 @@ int libc_system_init(void) { -#if defined(RT_USING_DFS) & defined(RT_USING_DFS_DEVFS) +#if defined(RT_USING_DFS) && defined(RT_USING_DFS_DEVFS) rt_device_t dev_console; dev_console = rt_console_get_device(); @@ -50,10 +50,11 @@ int libc_system_init(void) } #endif -#if defined RT_USING_PTHREADS && !defined RT_USING_COMPONENTS_INIT +#if defined (RT_USING_PTHREADS) && !defined (RT_USING_COMPONENTS_INIT) pthread_system_init(); #endif return 0; } INIT_COMPONENT_EXPORT(libc_system_init); + diff --git a/components/libc/compilers/newlib/stdio.c b/components/libc/compilers/newlib/stdio.c index f28383818d..9a225622b5 100644 --- a/components/libc/compilers/newlib/stdio.c +++ b/components/libc/compilers/newlib/stdio.c @@ -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) { |
