summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-05-07 01:12:51 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-05-07 01:13:37 +0200
commit6f1cacf1e64dfd917b23be56e7ee3444dcd3c0c3 (patch)
tree685b1fd6b2126d4a550876884a68646ddc9b9016
parentc0da7fa6a4486d31e86492567713d13eda51a2c0 (diff)
downloadgnutls-6f1cacf1e64dfd917b23be56e7ee3444dcd3c0c3.tar.gz
Do not use /tmp for temporary file. Just use the local (test) directory.
-rw-r--r--tests/rng-fork.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/rng-fork.c b/tests/rng-fork.c
index c7fc1890b6..4bb396bc6d 100644
--- a/tests/rng-fork.c
+++ b/tests/rng-fork.c
@@ -46,8 +46,8 @@ int i;
printf("\n");
}
-
-
+#define FILENAME "./rng-test"
+
void
doit (void)
{
@@ -57,13 +57,11 @@ doit (void)
int ret;
FILE* fp;
-
gnutls_global_init ();
-
pid = fork();
if (pid == 0)
{
- fp = fopen("/tmp/rng-test", "w");
+ fp = fopen(FILENAME, "w");
if (fp == NULL)
fail("cannot open file");
@@ -80,12 +78,15 @@ doit (void)
if (debug) dump("buf2", buf2, sizeof(buf2));
waitpid(pid, NULL, 0);
- fp = fopen("/tmp/rng-test", "r");
+ fp = fopen(FILENAME, "r");
if (fp == NULL)
fail("cannot open file");
ret = fread(buf1, 1, sizeof(buf1), fp);
+ fclose(fp);
+ remove(FILENAME);
+
if (ret != sizeof(buf1))
{
fail("error testing the random generator.");