diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-08-19 03:33:51 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-08-19 03:33:51 +0000 |
commit | 0e9eb96aee533c5d7ded06ec0ee95d20190e7cc7 (patch) | |
tree | e47041de6cab5ad9f1cce9762c6f3a6691ba7b40 | |
parent | 55fc74037ce1fed2313813918c5380b1c642828e (diff) | |
download | FreeBSD-src-0e9eb96aee533c5d7ded06ec0ee95d20190e7cc7.zip FreeBSD-src-0e9eb96aee533c5d7ded06ec0ee95d20190e7cc7.tar.gz |
Save and restore errno around sigprocmask.
-rw-r--r-- | lib/libkse/thread/thr_fork.c | 6 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_fork.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c index 6408fef..f640614 100644 --- a/lib/libkse/thread/thr_fork.c +++ b/lib/libkse/thread/thr_fork.c @@ -48,6 +48,7 @@ _fork(void) sigset_t sigset, oldset; struct pthread *curthread; pid_t ret; + int errsave; if (!_kse_isthreaded()) return (__sys_fork()); @@ -71,8 +72,11 @@ _fork(void) _kse_single_thread(curthread); /* Kernel signal mask is restored in _kse_single_thread */ } else { - if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) + if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) { + errsave = errno; __sys_sigprocmask(SIG_SETMASK, &oldset, NULL); + errno = errsave; + } } /* Return the process ID: */ diff --git a/lib/libpthread/thread/thr_fork.c b/lib/libpthread/thread/thr_fork.c index 6408fef..f640614 100644 --- a/lib/libpthread/thread/thr_fork.c +++ b/lib/libpthread/thread/thr_fork.c @@ -48,6 +48,7 @@ _fork(void) sigset_t sigset, oldset; struct pthread *curthread; pid_t ret; + int errsave; if (!_kse_isthreaded()) return (__sys_fork()); @@ -71,8 +72,11 @@ _fork(void) _kse_single_thread(curthread); /* Kernel signal mask is restored in _kse_single_thread */ } else { - if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) + if (curthread->attr.flags & PTHREAD_SCOPE_SYSTEM) { + errsave = errno; __sys_sigprocmask(SIG_SETMASK, &oldset, NULL); + errno = errsave; + } } /* Return the process ID: */ |