diff options
Diffstat (limited to 'regress/lib/libpthread/sigwait/sigwait.c')
-rw-r--r-- | regress/lib/libpthread/sigwait/sigwait.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/regress/lib/libpthread/sigwait/sigwait.c b/regress/lib/libpthread/sigwait/sigwait.c index a166eaf2a1e..70ed4f576cc 100644 --- a/regress/lib/libpthread/sigwait/sigwait.c +++ b/regress/lib/libpthread/sigwait/sigwait.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sigwait.c,v 1.1 2001/08/15 14:37:16 fgsch Exp $ */ +/* $OpenBSD: sigwait.c,v 1.2 2001/11/11 23:26:35 deraadt Exp $ */ /* * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com> * All rights reserved. @@ -80,11 +80,17 @@ sigwaiter (void *arg) static void sighandler (int signo) { - printf (" -> Signal handler caught signal %d (%s) in thread %p\n", + int save_errno = errno; + char buf[8192]; + + snprintf(buf, sizeof buf, + " -> Signal handler caught signal %d (%s) in thread %p\n", signo, strsignal(signo), pthread_self()); + write(STDOUT_FILENO, buf, strlen(buf)); if ((signo >= 0) && (signo <= NSIG)) sigcounts[signo]++; + errno = save_errno; } int main (int argc, char *argv[]) |