diff --git a/lib/libkse/thread/thr_sigprocmask.c b/lib/libkse/thread/thr_sigprocmask.c index ec39da009a82..9cb493a8c612 100644 --- a/lib/libkse/thread/thr_sigprocmask.c +++ b/lib/libkse/thread/thr_sigprocmask.c @@ -44,8 +44,10 @@ __weak_reference(_sigprocmask, sigprocmask); int _sigprocmask(int how, const sigset_t *set, sigset_t *oset) { - if (_kse_isthreaded() != 0) - return (pthread_sigmask(how, set, oset)); - else - return (__sys_sigprocmask(how, set, oset)); + int ret; + + ret = pthread_sigmask(how, set, oset); + if ((ret == 0) && (_kse_isthreaded() == 0)) + ret = __sys_sigprocmask(how, set, oset); + return (ret); } diff --git a/lib/libpthread/thread/thr_sigprocmask.c b/lib/libpthread/thread/thr_sigprocmask.c index ec39da009a82..9cb493a8c612 100644 --- a/lib/libpthread/thread/thr_sigprocmask.c +++ b/lib/libpthread/thread/thr_sigprocmask.c @@ -44,8 +44,10 @@ __weak_reference(_sigprocmask, sigprocmask); int _sigprocmask(int how, const sigset_t *set, sigset_t *oset) { - if (_kse_isthreaded() != 0) - return (pthread_sigmask(how, set, oset)); - else - return (__sys_sigprocmask(how, set, oset)); + int ret; + + ret = pthread_sigmask(how, set, oset); + if ((ret == 0) && (_kse_isthreaded() == 0)) + ret = __sys_sigprocmask(how, set, oset); + return (ret); }