summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sleep.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-05-26 08:33:42 +0000
committerderaadt <deraadt@openbsd.org>1996-05-26 08:33:42 +0000
commit978a0c12224b3c8efa1bf19ded30eea0a404a10d (patch)
treee29378ac859ecff3d4f2684a61b758415cff8e44 /lib/libc/gen/sleep.c
parentfixed the "/* in comments" problem. (diff)
downloadwireguard-openbsd-978a0c12224b3c8efa1bf19ded30eea0a404a10d.tar.xz
wireguard-openbsd-978a0c12224b3c8efa1bf19ded30eea0a404a10d.zip
signal mask repair, netbsd pr#2442
Diffstat (limited to 'lib/libc/gen/sleep.c')
-rw-r--r--lib/libc/gen/sleep.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/libc/gen/sleep.c b/lib/libc/gen/sleep.c
index cba9c97b2e1..f369d54159e 100644
--- a/lib/libc/gen/sleep.c
+++ b/lib/libc/gen/sleep.c
@@ -104,12 +104,7 @@ sleep(seconds)
ringring = 0;
(void) sigsuspend(&set);
- if (ringring) {
- /* Our alarm went off; timer is not currently running */
- sigaction(SIGALRM, &oact, NULL);
- sigprocmask(SIG_SETMASK, &oset, NULL);
- (void) setitimer(ITIMER_REAL, &oitv, &itv);
- } else {
+ if (!ringring) {
struct itimerval nulltv;
/*
* Interrupted by other signal; allow for pending
@@ -119,10 +114,10 @@ sleep(seconds)
timerclear(&nulltv.it_interval);
timerclear(&nulltv.it_value);
(void) setitimer(ITIMER_REAL, &nulltv, &itv);
- sigprocmask(SIG_SETMASK, &oset, NULL);
- sigaction(SIGALRM, &oact, NULL);
- (void) setitimer(ITIMER_REAL, &oitv, NULL);
}
+ sigprocmask(SIG_SETMASK, &oset, NULL);
+ sigaction(SIGALRM, &oact, NULL);
+ (void) setitimer(ITIMER_REAL, &oitv, &itv);
if (timerisset(&diff))
timeradd(&itv.it_value, &diff, &itv.it_value);