From 14295a59d3e9b6a20d4cef1aeaa19f31f84ec30b Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sun, 10 Jul 2011 00:01:33 +0000 Subject: [PATCH] pthread_sigmask: fix return value to match POSIX * signal.cc (handle_sigprocmask): Return error rather than setting errno, for pthread_sigmask. (sigprocmask): Adjust caller. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/signal.cc | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) 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;