]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Do not use /tmp for temporary file. Just use the local (test) directory.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 6 May 2011 23:12:51 +0000 (01:12 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 6 May 2011 23:12:51 +0000 (01:12 +0200)
tests/rng-fork.c

index c7fc1890b679a3e633ad8f8f7c0425854065aa9b..4bb396bc6d210426e8bae535409fb2e27447bfb4 100644 (file)
@@ -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.");