diff options
author | 2014-11-16 05:24:25 +0000 | |
---|---|---|
committer | 2014-11-16 05:24:25 +0000 | |
commit | b2319fda1062ab045256a9767f416e1b8d082202 (patch) | |
tree | ea43ff82203581ba57c0ba6670b21dd8d49b8810 /lib/librthread/rthread_sig.c | |
parent | Delete a test which required behavior not defined by the spec (diff) | |
download | wireguard-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.c | 10 |
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; |