diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-06-26 08:20:15 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-06-30 14:57:25 +0200 |
commit | 9b07f5efe364bc52b80eff83389ee4bf4a1e0c40 (patch) | |
tree | 266853181a9178bdff8e49130c9e42d5c3e30262 | |
parent | smptests/smpschededf01: New test (diff) | |
download | rtems-9b07f5efe364bc52b80eff83389ee4bf4a1e0c40.tar.bz2 |
newlib01: Use fopen() instead of freopen()
With global stdio streams, a freopen() would close the global stream
object.
Update #3012.
-rw-r--r-- | testsuites/libtests/newlib01/init.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/testsuites/libtests/newlib01/init.c b/testsuites/libtests/newlib01/init.c index f9d39368d2..af2dc355a7 100644 --- a/testsuites/libtests/newlib01/init.c +++ b/testsuites/libtests/newlib01/init.c @@ -19,6 +19,7 @@ #include <stdio.h> #include <rtems.h> +#include <rtems/console.h> #include <rtems/imfs.h> #include <rtems/libcsupport.h> @@ -62,13 +63,13 @@ static void wait(void) static void worker_task(rtems_task_argument arg) { test_context *ctx = &test_instance; - FILE *file = freopen(&file_path[0], "r+", stdout); char buf[1] = { 'x' }; size_t n; - rtems_test_assert(file != NULL); + stdout = fopen(&file_path[0], "r+"); + rtems_test_assert(stdout != NULL); - n = fwrite(&buf[0], sizeof(buf), 1, file); + n = fwrite(&buf[0], sizeof(buf), 1, stdout); rtems_test_assert(n == 1); rtems_test_assert(ctx->current == OPEN); @@ -244,9 +245,16 @@ static void test(void) rtems_status_code sc; int rv; rtems_resource_snapshot snapshot; + FILE *file; ctx->main_task_id = rtems_task_self(); + /* Fill dynamic file pool in Newlib _GLOBAL_REENT */ + file = fopen(CONSOLE_DEVICE_NAME, "r+"); + rtems_test_assert(file != NULL); + rv = fclose(file); + rtems_test_assert(rv == 0); + rtems_resource_snapshot_take(&snapshot); rv = IMFS_make_generic_node( |