From 96cd0558bcd69481ccc42e1b392f0c0b36fce2b0 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 28 Nov 2018 19:59:45 +0100 Subject: support: Add signal support to support_capture_subprocess_check Signal zero does not terminate a process, so it is safe to use negative values for signal numbers. Adjust libio/tst-vtables-common.c to use this new functionality, instead of determining the termination status for a signal indirectly. --- libio/tst-vtables-common.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'libio') diff --git a/libio/tst-vtables-common.c b/libio/tst-vtables-common.c index 5e31012069..85e246cd11 100644 --- a/libio/tst-vtables-common.c +++ b/libio/tst-vtables-common.c @@ -380,21 +380,6 @@ without_compatibility_fflush (void *closure) _exit (1); } -/* Exit status after abnormal termination. */ -static int termination_status; - -static void -init_termination_status (void) -{ - pid_t pid = xfork (); - if (pid == 0) - abort (); - xwaitpid (pid, &termination_status, 0); - - TEST_VERIFY (WIFSIGNALED (termination_status)); - TEST_COMPARE (WTERMSIG (termination_status), SIGABRT); -} - static void check_for_termination (const char *name, void (*callback) (void *)) { @@ -404,7 +389,7 @@ check_for_termination (const char *name, void (*callback) (void *)) shared->calls = 0; struct support_capture_subprocess proc = support_capture_subprocess (callback, NULL); - support_capture_subprocess_check (&proc, name, termination_status, + support_capture_subprocess_check (&proc, name, -SIGABRT, sc_allow_stderr); const char *message = "Fatal error: glibc detected an invalid stdio handle\n"; @@ -491,7 +476,6 @@ run_tests (bool initially_disabled) shared = support_shared_allocate (sizeof (*shared)); shared->initially_disabled = initially_disabled; - init_termination_status (); if (initially_disabled) { -- cgit v1.2.3