Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpthread Fetch the old signal mask for the signal acti...
details: https://anonhg.NetBSD.org/src/rev/af0f8c049f49
branches: trunk
changeset: 574319:af0f8c049f49
user: nathanw <nathanw%NetBSD.org@localhost>
date: Sat Feb 26 18:15:25 2005 +0000
description:
Fetch the old signal mask for the signal action whether or not we're
setting a new signal action; this makes sigaction(sig, NULL, &oact)
return a sensible value in the signal mask instead of stack trash.
Addresses PR lib/29536.
XXX the mask seen by signal handlers in a program linked with
libpthread but not yet multithreaded will not reflect masks set here.
diffstat:
lib/libpthread/pthread_sig.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (41 lines):
diff -r 3f2fbb802c6e -r af0f8c049f49 lib/libpthread/pthread_sig.c
--- a/lib/libpthread/pthread_sig.c Sat Feb 26 18:10:35 2005 +0000
+++ b/lib/libpthread/pthread_sig.c Sat Feb 26 18:15:25 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_sig.c,v 1.36 2004/08/24 01:46:30 nathanw Exp $ */
+/* $NetBSD: pthread_sig.c,v 1.37 2005/02/26 18:15:25 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sig.c,v 1.36 2004/08/24 01:46:30 nathanw Exp $");
+__RCSID("$NetBSD: pthread_sig.c,v 1.37 2005/02/26 18:15:25 nathanw Exp $");
/* We're interposing a specific version of the signal interface. */
#define __LIBC12_SOURCE__
@@ -201,10 +201,10 @@
return EINVAL;
self = pthread__self();
+ pthread_spinlock(self, &pt_sigacts_lock);
+ oldmask = pt_sigacts[sig].sa_mask;
if (act != NULL) {
/* Save the information for our internal dispatch. */
- pthread_spinlock(self, &pt_sigacts_lock);
- oldmask = pt_sigacts[sig].sa_mask;
pt_sigacts[sig] = *act;
pthread_spinunlock(self, &pt_sigacts_lock);
/*
@@ -218,7 +218,8 @@
realact = *act;
__sigemptyset14(&realact.sa_mask);
act = &realact;
- }
+ } else
+ pthread_spinunlock(self, &pt_sigacts_lock);
retval = __libc_sigaction14(sig, act, oact);
if (oact && (retval == 0))
Home |
Main Index |
Thread Index |
Old Index