summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread_sig.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-11-16 05:24:25 +0000
committerguenther <guenther@openbsd.org>2014-11-16 05:24:25 +0000
commitb2319fda1062ab045256a9767f416e1b8d082202 (patch)
treeea43ff82203581ba57c0ba6670b21dd8d49b8810 /lib/librthread/rthread_sig.c
parentDelete a test which required behavior not defined by the spec (diff)
downloadwireguard-openbsd-b2319fda1062ab045256a9767f416e1b8d082202.tar.xz
wireguard-openbsd-b2319fda1062ab045256a9767f416e1b8d082202.zip
Don't assume __thrsigdivert() autorestarts on EINTR. This lets us check for
cancellation properly when a handled (but not waited for) signal occurs ok tedu@
Diffstat (limited to 'lib/librthread/rthread_sig.c')
-rw-r--r--lib/librthread/rthread_sig.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/librthread/rthread_sig.c b/lib/librthread/rthread_sig.c
index 4983f0d6d52..3c5ec8a59c1 100644
--- a/lib/librthread/rthread_sig.c
+++ b/lib/librthread/rthread_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_sig.c,v 1.15 2013/06/21 06:08:50 guenther Exp $ */
+/* $OpenBSD: rthread_sig.c,v 1.16 2014/11/16 05:24:25 guenther Exp $ */
/*
* Copyright (c) 2005 Ted Unangst <tedu@openbsd.org>
* All Rights Reserved.
@@ -53,9 +53,11 @@ sigwait(const sigset_t *set, int *sig)
int ret;
sigdelset(&s, SIGTHR);
- _enter_cancel(self);
- ret = __thrsigdivert(s, NULL, NULL);
- _leave_cancel(self);
+ do {
+ _enter_cancel(self);
+ ret = __thrsigdivert(s, NULL, NULL);
+ _leave_cancel(self);
+ } while (ret == -1 && errno == EINTR);
if (ret == -1)
return (errno);
*sig = ret;