This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC PATCH v4 3/5] support record failure: flush stdout, use _exit ()
- From: Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>, Szabolcs Nagy <szabolcs dot nagy at arm dot com>, libc-alpha at sourceware dot org, Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>
- Date: Wed, 21 Nov 2018 13:39:34 -0500
- Subject: [RFC PATCH v4 3/5] support record failure: flush stdout, use _exit ()
- Dkim-filter: OpenDKIM Filter v2.10.3 mail.efficios.com BFD50133E91
- References: <20181121183936.8176-1-mathieu.desnoyers@efficios.com>
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