This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC PATCH v4 3/5] support record failure: flush stdout, use _exit ()


Using "exit ()" from pthread_atfork handlers hangs the process. It is
therefore not a good way to exit when reporting a testing error.

Use _exit () instead, which directly exits the process. However,
considering that the buffered stdout is used to output test failure
messages, we first need to flush stdout before exiting.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Carlos O'Donell <carlos@redhat.com>
CC: Florian Weimer <fweimer@redhat.com>
CC: Joseph Myers <joseph@codesourcery.com>
CC: Szabolcs Nagy <szabolcs.nagy@arm.com>
CC: libc-alpha@sourceware.org
---
 support/check.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/support/check.c b/support/check.c
index 78f2b3cde1..bed1d20457 100644
--- a/support/check.c
+++ b/support/check.c
@@ -22,6 +22,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <support/test-driver.h>
 
 static void
@@ -56,5 +57,6 @@ support_exit_failure_impl (int status, const char *file, int line,
   va_start (ap, format);
   print_failure (file, line, format, ap);
   va_end (ap);
-  exit (status);
+  fflush (stdout);
+  _exit (status);
 }
-- 
2.17.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]