diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index da03f8b25..76a6022d0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2011-07-09 Eric Blake + + * signal.cc (handle_sigprocmask): Return error rather than setting + errno, for pthread_sigmask. + (sigprocmask): Adjust caller. + 2011-07-07 Corinna Vinschen * miscfuncs.cc (yield): Drop thread priority only once. diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 9c920d037..4c472fda3 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -174,7 +174,10 @@ usleep (useconds_t useconds) extern "C" int sigprocmask (int how, const sigset_t *set, sigset_t *oldset) { - return handle_sigprocmask (how, set, oldset, _my_tls.sigmask); + int res = handle_sigprocmask (how, set, oldset, _my_tls.sigmask); + if (res) + set_errno (res); + return res ? -1 : 0; } int __stdcall @@ -184,13 +187,12 @@ handle_sigprocmask (int how, const sigset_t *set, sigset_t *oldset, sigset_t& op if (how != SIG_BLOCK && how != SIG_UNBLOCK && how != SIG_SETMASK) { syscall_printf ("Invalid how value %d", how); - set_errno (EINVAL); - return -1; + return EINVAL; } myfault efault; if (efault.faulted (EFAULT)) - return -1; + return EFAULT; if (oldset) *oldset = opmask;