[PATCH] test-skeleton: redirect stderr to stdout

Mike Frysinger vapier@gentoo.org
Thu Jun 16 04:48:00 GMT 2016


Rather than worry if we use funcs that dirty stderr instead of writing
to stdout, redirect stderr internally to stdout.  Now all output will
go to stdout regardless.
---
 test-skeleton.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test-skeleton.c b/test-skeleton.c
index a9ad4ab7e9c6..3ff55810f0ec 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -343,6 +343,10 @@ main (int argc, char *argv[])
   setbuf (stdout, NULL);
 #endif
 
+  fclose (stderr);
+  dup2 (STDOUT_FILENO, STDERR_FILENO);
+  stderr = fdopen (STDERR_FILENO, "w");
+
   while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1)
     switch (opt)
       {
-- 
2.8.2



More information about the Libc-alpha mailing list