@@ -33,7 +33,6 @@ const char * tst_reports[] = {
3333};
3434
3535#ifdef HAVE_MPI2_THREADS
36- extern int num_threads ;
3736extern int tst_thread_running (void );
3837#endif
3938
@@ -73,16 +72,6 @@ tst_output_types tst_output_init(tst_output_stream * output, int rank,
7372 }
7473#endif
7574
76- /* Check if stream type uses a file and get the name of this file */
77- if (type == TST_OUTPUT_TYPE_LOGFILE ) {
78- va_start (arglist , type );
79- fname = va_arg (arglist , char * );
80- sprintf (output -> filename ,"R%d_" , tst_output_global_rank );
81- freelen = 255 - strlen (output -> filename );
82- strncat (output -> filename , fname , freelen );
83- va_end (arglist );
84- }
85-
8675 /* Now do the initialisation for the different stream types */
8776 switch (type ) {
8877 case TST_OUTPUT_TYPE_STDERR :
@@ -92,6 +81,11 @@ tst_output_types tst_output_init(tst_output_stream * output, int rank,
9281 output -> streamptr = stdout ;
9382 break ;
9483 case TST_OUTPUT_TYPE_LOGFILE :
84+ va_start (arglist , type );
85+ fname = va_arg (arglist , char * );
86+ snprintf (output -> filename , TST_OUTPUT_FILENAME_MAX , "R%d_%s" ,
87+ tst_output_global_rank , fname );
88+ va_end (arglist );
9589 output -> streamptr = fopen (output -> filename , "w+" );
9690 if (output -> streamptr == NULL ) {
9791 fprintf (stderr , "Error opening stream: Could not open output file." );
0 commit comments