summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2011-01-25 18:42:46 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2011-01-25 18:42:46 +0000
commit412272acee23634745871fe5ba77ee2bfd896951 (patch)
tree3060c0358fe54d369b4500c6b779237aec2aaf97
parent47d4d332103affebb1831d7ebef4b85e001f9592 (diff)
Don't ignore copyout() return value in sys_thrsleep().
Spotted by miod some time ago. ok miod guenther
-rw-r--r--sys/kern/kern_synch.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 7fdd5e72d2d..137dbb35973 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.95 2010/06/29 00:28:14 tedu Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.96 2011/01/25 18:42:45 stsp Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -428,8 +428,11 @@ sys_thrsleep(struct proc *p, void *v, register_t *revtal)
if (timespeccmp(&ats, &now, <)) {
/* already passed: still do the unlock */
- if (lock)
- copyout(&unlocked, lock, sizeof(unlocked));
+ if (lock) {
+ if ((error = copyout(&unlocked, lock,
+ sizeof(unlocked))) != 0)
+ return (error);
+ }
return (EWOULDBLOCK);
}
@@ -444,8 +447,10 @@ sys_thrsleep(struct proc *p, void *v, register_t *revtal)
p->p_thrslpid = ident;
- if (lock)
- copyout(&unlocked, lock, sizeof(unlocked));
+ if (lock) {
+ if ((error = copyout(&unlocked, lock, sizeof(unlocked))) != 0)
+ return (error);
+ }
error = tsleep(&p->p_thrslpid, PUSER | PCATCH, "thrsleep",
(int)to_ticks);