public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* Re: pthread_sigmask bug
       [not found] ` <20110709065855.GB29867@calimero.vinschen.de>
@ 2011-07-09 13:19   ` Eric Blake
  2011-07-09 19:31     ` Christopher Faylor
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Blake @ 2011-07-09 13:19 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pthread_sigmask bug
  2011-07-09 13:19   ` pthread_sigmask bug Eric Blake
@ 2011-07-09 19:31     ` Christopher Faylor
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Faylor @ 2011-07-09 19:31 UTC (permalink / raw)
  To: cygwin-patches

On Sat, Jul 09, 2011 at 07:19:35AM -0600, Eric Blake wrote:
>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.

Looks good.  Please apply.  Thanks.

cgf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-09 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4E178FD6.5010101@redhat.com>
     [not found] ` <20110709065855.GB29867@calimero.vinschen.de>
2011-07-09 13:19   ` pthread_sigmask bug Eric Blake
2011-07-09 19:31     ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).