Changeset 9b07f5e in rtems


Ignore:
Timestamp:
Jun 26, 2017, 6:20:15 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
550616e5
Parents:
7adf4941
git-author:
Sebastian Huber <sebastian.huber@…> (06/26/17 06:20:15)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/30/17 12:57:25)
Message:

newlib01: Use fopen() instead of freopen()

With global stdio streams, a freopen() would close the global stream
object.

Update #3012.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/newlib01/init.c

    r7adf4941 r9b07f5e  
    2020
    2121#include <rtems.h>
     22#include <rtems/console.h>
    2223#include <rtems/imfs.h>
    2324#include <rtems/libcsupport.h>
     
    6364{
    6465  test_context *ctx = &test_instance;
    65   FILE *file = freopen(&file_path[0], "r+", stdout);
    6666  char buf[1] = { 'x' };
    6767  size_t n;
    6868
    69   rtems_test_assert(file != NULL);
    70 
    71   n = fwrite(&buf[0], sizeof(buf), 1, file);
     69  stdout = fopen(&file_path[0], "r+");
     70  rtems_test_assert(stdout != NULL);
     71
     72  n = fwrite(&buf[0], sizeof(buf), 1, stdout);
    7273  rtems_test_assert(n == 1);
    7374
     
    245246  int rv;
    246247  rtems_resource_snapshot snapshot;
     248  FILE *file;
    247249
    248250  ctx->main_task_id = rtems_task_self();
     251
     252  /* Fill dynamic file pool in Newlib _GLOBAL_REENT */
     253  file = fopen(CONSOLE_DEVICE_NAME, "r+");
     254  rtems_test_assert(file != NULL);
     255  rv = fclose(file);
     256  rtems_test_assert(rv == 0);
    249257
    250258  rtems_resource_snapshot_take(&snapshot);
Note: See TracChangeset for help on using the changeset viewer.