summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sleep.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-09-30 12:21:30 +0000
committerderaadt <deraadt@openbsd.org>1996-09-30 12:21:30 +0000
commitc581f17e526904b8072b89f4879057b0fc0ed1ca (patch)
treee99b10c84e22acafb2e1d8455528132b9e32539c /lib/libc/gen/sleep.c
parentsync sparc (diff)
downloadwireguard-openbsd-c581f17e526904b8072b89f4879057b0fc0ed1ca.tar.xz
wireguard-openbsd-c581f17e526904b8072b89f4879057b0fc0ed1ca.zip
if interrupted, return time unslept; from phil nelson
Diffstat (limited to 'lib/libc/gen/sleep.c')
-rw-r--r--lib/libc/gen/sleep.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/gen/sleep.c b/lib/libc/gen/sleep.c
index cf389ee10c8..9245e47f914 100644
--- a/lib/libc/gen/sleep.c
+++ b/lib/libc/gen/sleep.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: sleep.c,v 1.5 1996/09/15 09:31:05 tholo Exp $";
+static char rcsid[] = "$OpenBSD: sleep.c,v 1.6 1996/09/30 12:21:30 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/time.h>
@@ -108,10 +108,11 @@ sleep(seconds)
timerclear(&nulltv.it_interval);
timerclear(&nulltv.it_value);
(void) setitimer(ITIMER_REAL, &nulltv, &itv);
- }
+ } else
+ timerclear(&itv.it_value);
sigprocmask(SIG_SETMASK, &oset, NULL);
sigaction(SIGALRM, &oact, NULL);
- (void) setitimer(ITIMER_REAL, &oitv, &itv);
+ (void) setitimer(ITIMER_REAL, &oitv, NULL);
if (timerisset(&diff))
timeradd(&itv.it_value, &diff, &itv.it_value);