summaryrefslogtreecommitdiffstats
path: root/g10/signal.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-09-23 19:48:33 +0200
committerWerner Koch <wk@gnupg.org>2003-09-23 19:48:33 +0200
commit4c66e94ff91d680eaf1d9c48a62d66d1951f90ef (patch)
tree66ede04edbfe1c45eece46e852093282832f8312 /g10/signal.c
parent2003-09-22 Timo Schulz <twoaday@freakmail.de> (diff)
downloadgnupg2-4c66e94ff91d680eaf1d9c48a62d66d1951f90ef.tar.xz
gnupg2-4c66e94ff91d680eaf1d9c48a62d66d1951f90ef.zip
Merged most of David Shaw's changes in 1.3 since 2003-06-03.
Diffstat (limited to 'g10/signal.c')
-rw-r--r--g10/signal.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/g10/signal.c b/g10/signal.c
index 90c0841d8..9f50fbe3a 100644
--- a/g10/signal.c
+++ b/g10/signal.c
@@ -1,5 +1,5 @@
/* signal.c - signal handling
- * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -42,7 +42,7 @@ static void
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
{
#ifndef HAVE_DOSISH_SYSTEM
-#ifdef HAVE_SIGACTION
+#if defined(HAVE_SIGACTION) && defined(HAVE_STRUCT_SIGACTION)
struct sigaction oact, nact;
if (check_ign) {
@@ -132,7 +132,7 @@ void
pause_on_sigusr( int which )
{
#ifndef HAVE_DOSISH_SYSTEM
-#ifdef HAVE_SIGPROCMASK
+#if defined(HAVE_SIGPROCMASK) && defined(HAVE_SIGSET_T)
sigset_t mask, oldmask;
assert( which == 1 );
@@ -150,8 +150,8 @@ pause_on_sigusr( int which )
while (!caught_sigusr1)
sigpause(SIGUSR1);
caught_sigusr1 = 0;
- sigrelse(SIGUSR1); ????
-#endif /*!HAVE_SIGPROCMASK*/
+ sigrelse(SIGUSR1);
+#endif /*!HAVE_SIGPROCMASK && HAVE_SISET_T*/
#endif
}
@@ -161,7 +161,7 @@ do_block( int block )
{
#ifndef HAVE_DOSISH_SYSTEM
static int is_blocked;
-#ifdef HAVE_SIGPROCMASK
+#if defined(HAVE_SIGPROCMASK) && defined(HAVE_SIGSET_T)
static sigset_t oldmask;
if( block ) {
@@ -180,13 +180,22 @@ do_block( int block )
is_blocked = 0;
}
#else /*!HAVE_SIGPROCMASK*/
- static void (*disposition[MAXSIG])();
+
+#if defined(NSIG)
+# define SIGSMAX (NSIG)
+#elif defined(MAXSIG)
+# define SIGSMAX (MAXSIG+1)
+#else
+# error "define SIGSMAX to the number of signals on your platform plus one"
+#endif
+
+ static void (*disposition[SIGSMAX])(int);
int sig;
if( block ) {
if( is_blocked )
log_bug("signals are already blocked\n");
- for (sig=1; sig < MAXSIG; sig++) {
+ for (sig=1; sig < SIGSMAX; sig++) {
disposition[sig] = sigset (sig, SIG_HOLD);
}
is_blocked = 1;
@@ -194,7 +203,7 @@ do_block( int block )
else {
if( !is_blocked )
log_bug("signals are not blocked\n");
- for (sig=1; sig < MAXSIG; sig++) {
+ for (sig=1; sig < SIGSMAX; sig++) {
sigset (sig, disposition[sig]);
}
is_blocked = 0;