summaryrefslogtreecommitdiff
path: root/regress/lib/libpthread/sigwait
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-11-11 23:26:36 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-11-11 23:26:36 +0000
commit854e32bfa0ac46bd779092588acc3ad83723617f (patch)
treeeb8c4c07328fbf5349c22f59ef1547c27bb5a29c /regress/lib/libpthread/sigwait
parent4907cd2837006c10a4de5ff099eea656e5a089b8 (diff)
signal race fixes
Diffstat (limited to 'regress/lib/libpthread/sigwait')
-rw-r--r--regress/lib/libpthread/sigwait/sigwait.c10
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[])