diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-10 04:04:35 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-10 04:04:35 +0000 |
commit | 6dc04d6486bfaf047990afa0262d7f9d859442de (patch) | |
tree | 672d63c2769d2787e8447b54271914e8e9b7e29d /regress/lib | |
parent | 075a7f386fc88d294f22f9abe27c0593d052e6b7 (diff) |
In a signal handler use snprintf()+local buffer instead of asprintf+free
Diffstat (limited to 'regress/lib')
-rw-r--r-- | regress/lib/libpthread/pthread_kill/pthread_kill.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/regress/lib/libpthread/pthread_kill/pthread_kill.c b/regress/lib/libpthread/pthread_kill/pthread_kill.c index a4a63d15538..c72df7bc463 100644 --- a/regress/lib/libpthread/pthread_kill/pthread_kill.c +++ b/regress/lib/libpthread/pthread_kill/pthread_kill.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_kill.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ +/* $OpenBSD: pthread_kill.c,v 1.5 2016/05/10 04:04:34 guenther Exp $ */ /* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */ /* @@ -18,15 +18,15 @@ static void act_handler(int signal, siginfo_t *siginfo, void *context) { struct sigaction sa; - char *str; + char buf[200]; CHECKe(sigaction(SIGUSR1, NULL, &sa)); ASSERT(sa.sa_handler == SIG_DFL); ASSERT(siginfo != NULL); - asprintf(&str, "act_handler: signal %d, siginfo %p, context %p\n", - signal, siginfo, context); - write(STDOUT_FILENO, str, strlen(str)); - free(str); + snprintf(buf, sizeof buf, + "act_handler: signal %d, siginfo %p, context %p\n", + signal, siginfo, context); + write(STDOUT_FILENO, buf, strlen(buf)); } static void * |