summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-09-05 21:24:25 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-09-05 21:24:25 +0000
commit365a9d93af66515d1bf1f7f107ce9a090cf1029c (patch)
tree76a75af852665988a12f64fcfc4849bd879dfbb1 /lib
parent1781b2b10cfcdd88b814ab250fbad234b8af23e7 (diff)
The scheduling loop can change errno, so we need to restore it even
when not switching threads; issue observed by fgsch@ ok marc@
Diffstat (limited to 'lib')
-rw-r--r--lib/libpthread/uthread/uthread_kern.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c
index dab360b40fe..80b873ee633 100644
--- a/lib/libpthread/uthread/uthread_kern.c
+++ b/lib/libpthread/uthread/uthread_kern.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_kern.c,v 1.38 2011/07/07 09:25:16 guenther Exp $ */
+/* $OpenBSD: uthread_kern.c,v 1.39 2011/09/05 21:24:24 guenther Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -467,6 +467,9 @@ _thread_kern_sched(struct sigcontext * scp)
curthread->slice_usec = 0;
}
+ /* Restore errno. */
+ errno = curthread->error;
+
/*
* If we're 'switching' to the current thread,
* then don't bother with the save/restore
@@ -474,9 +477,6 @@ _thread_kern_sched(struct sigcontext * scp)
if (curthread == old_thread_run)
goto after_switch;
- /* Restore errno. */
- errno = curthread->error;
-
/* Restore floating point state. */
_thread_machdep_restore_float_state(&curthread->_machdep);