This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthread_sigmask bug


On 07/09/2011 12:58 AM, Corinna Vinschen wrote:
> On Jul  8 17:16, Eric Blake wrote:
>> The current implementation of pthread_sigmask violates POSIX:
> 
> PTC?

 winsup/cygwin/ChangeLog |    6 ++++++
 winsup/cygwin/signal.cc |   10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

2011-07-09  Eric Blake  <eblake@redhat.com>

	* signal.cc (handle_sigprocmask): Return error rather than
	setting errno, for pthread_sigmask.
	(sigprocmask): Adjust caller.

diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 9c920d0..4c472fd 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;

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]