From b17f6c98146ddc0e3530670a34673ab2c9ea67e8 Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 29 Aug 2024 15:16:43 +0000 Subject: [PATCH] Use signal handler safe dprintf() instead of asprintf + write OK millert@ --- regress/lib/libpthread/siginfo/siginfo.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/regress/lib/libpthread/siginfo/siginfo.c b/regress/lib/libpthread/siginfo/siginfo.c index 1cd872f4bd4..58a1ed60c45 100644 --- a/regress/lib/libpthread/siginfo/siginfo.c +++ b/regress/lib/libpthread/siginfo/siginfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo.c,v 1.11 2016/09/01 11:04:37 guenther Exp $ */ +/* $OpenBSD: siginfo.c,v 1.12 2024/08/29 15:16:43 claudio Exp $ */ /* PUBLIC DOMAIN Oct 2002 */ /* @@ -19,16 +19,14 @@ static void act_handler(int signal, siginfo_t *siginfo, void *context) { struct sigaction sa; - char * str; CHECKe(sigaction(SIGSEGV, NULL, &sa)); ASSERT(sa.sa_handler == SIG_DFL); ASSERT(siginfo != NULL); - asprintf(&str, "act_handler: signal %d, siginfo %p, context %p\n" - "addr %p, code %d, trap %d\n", signal, siginfo, context, - siginfo->si_addr, siginfo->si_code, siginfo->si_trapno); - write(STDOUT_FILENO, str, strlen(str)); - free(str); + dprintf(STDOUT_FILENO, "act_handler: signal %d, siginfo %p, " + "context %p\naddr %p, code %d, trap %d\n", signal, siginfo, + context, siginfo->si_addr, siginfo->si_code, + siginfo->si_trapno); ASSERT(siginfo->si_addr == BOGUS); ASSERT(siginfo->si_code == SEGV_MAPERR || siginfo->si_code == SEGV_ACCERR); -- 2.20.1