forked from Imagelibrary/rtems
libcsupport/newlib: Call newlib's __sinit to force reent initialisation
- Newlib overtites any FILE pointers set in stdin, stdout or stderr. Closes #3870
This commit is contained in:
@@ -44,7 +44,10 @@ bool newlib_create_hook(
|
||||
}
|
||||
#endif
|
||||
|
||||
_REENT_INIT_PTR((creating_task->libc_reent)); /* GCC extension: structure constants */
|
||||
extern void __sinit (struct _reent *s);
|
||||
struct _reent *reent = (struct _reent *) creating_task->libc_reent;
|
||||
_REENT_INIT_PTR((reent)); /* GCC extension: structure constants */
|
||||
__sinit( reent );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,6 +245,10 @@ static void test(void)
|
||||
int rv;
|
||||
rtems_resource_snapshot snapshot;
|
||||
|
||||
rtems_test_assert(fileno(stdout) >= 0);
|
||||
rtems_test_assert(fileno(stdin) >= 0);
|
||||
rtems_test_assert(fileno(stderr) >= 0);
|
||||
|
||||
ctx->main_task_id = rtems_task_self();
|
||||
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
@@ -275,6 +279,10 @@ static void test(void)
|
||||
sc = rtems_task_delete(ctx->worker_task_id);
|
||||
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
|
||||
|
||||
rtems_test_assert(fileno(stdout) >= 0);
|
||||
rtems_test_assert(fileno(stdin) >= 0);
|
||||
rtems_test_assert(fileno(stderr) >= 0);
|
||||
|
||||
rv = unlink(&file_path[0]);
|
||||
rtems_test_assert(rv == 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user