summaryrefslogtreecommitdiff
path: root/tests/tio_str.c
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-04-06 11:25:38 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-04-06 11:25:38 +0000
commit881c1a1d7826d14f73e8571ced01d80cde00fa93 (patch)
tree12640d6a15fc471240229b66a6d8a1c0ea46529c /tests/tio_str.c
parente3e0eddce766fc00e3d49b55eac180c42846f67a (diff)
downloadmpc-881c1a1d7826d14f73e8571ced01d80cde00fa93.tar.gz
[acinclude.m4] added option -D_FORTIFY_SOURCE=2 in development mode
[tio_str.c] fixed warning generated by previous option git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@532 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tio_str.c')
-rw-r--r--tests/tio_str.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/tio_str.c b/tests/tio_str.c
index d569d1f..99eb989 100644
--- a/tests/tio_str.c
+++ b/tests/tio_str.c
@@ -1,6 +1,6 @@
/* tio_str.c -- Test file for mpc_inp_str and mpc_out_str.
-Copyright (C) 2009 Philippe Th\'eveny
+Copyright (C) 2009 Philippe Th\'eveny, Andreas Enge
This file is part of the MPC Library.
@@ -166,7 +166,11 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected)
fflush(stdout);
fd = dup(fileno(stdout));
- freopen(tmp_file, "w", stdout);
+ if (freopen(tmp_file, "w", stdout) == NULL)
+ {
+ printf ("mpc_inp_str cannot redirect stdout\n");
+ exit (1);
+ }
mpc_out_str (NULL, 2, 0, expected, MPC_RNDNN);
fflush(stdout);
dup2(fd, fileno(stdout));
@@ -175,7 +179,11 @@ check_stdout (mpc_ptr read_number, mpc_ptr expected)
fflush(stdin);
fd = dup(fileno(stdin));
- freopen(tmp_file, "r", stdin);
+ if (freopen(tmp_file, "r", stdin) == NULL)
+ {
+ printf ("mpc_inp_str cannot redirect stdout\n");
+ exit (1);
+ }
if (mpc_inp_str (read_number, NULL, &sz, 2, MPC_RNDNN) == -1)
{
printf ("mpc_inp_str cannot correctly re-read number "