Fix bug in redirection of unit test outputs

Avoid replacing handle. stdout is defined as a macro on several platforms.

Signed-off-by: gufe44 <gu981@protonmail.com>
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 9b2fa2b..8a4137b 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -434,7 +434,7 @@
                  */
                 if( !option_verbose )
                 {
-                    stdout_fd = redirect_output( &stdout, "/dev/null" );
+                    stdout_fd = redirect_output( stdout, "/dev/null" );
                     if( stdout_fd == -1 )
                     {
                         /* Redirection has failed with no stdout so exit */
@@ -446,7 +446,7 @@
                 ret = dispatch_test( cnt, params );
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-                if( !option_verbose && restore_output( &stdout, stdout_fd ) )
+                if( !option_verbose && restore_output( stdout, stdout_fd ) )
                 {
                         /* Redirection has failed with no stdout so exit */
                         exit( 1 );
@@ -541,10 +541,5 @@
     mbedtls_memory_buffer_alloc_free();
 #endif
 
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-    if( stdout_fd != -1 )
-        close_output( stdout );
-#endif /* __unix__ || __APPLE__ __MACH__ */
-
     return( total_errors != 0 );
 }