summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortgoodwin <tgoodwin>1998-07-09 16:33:42 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:07 +0100
commitf41b897207c2d23503cb813cd8117af9a5391912 (patch)
tree39588ade2f7acb046f84bde2a9c40ac59bb6758a
parent48c0b2add862b07e0c535e09bc1d0ae3c7661896 (diff)
don't ever try to set a signal to SIG_ERR
-rw-r--r--signal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/signal.c b/signal.c
index ab98702..876f069 100644
--- a/signal.c
+++ b/signal.c
@@ -99,8 +99,10 @@ extern void (*rc_signal(int s, void (*h)(int)))(int) {
extern void initsignal() {
void (*h)(int);
int i;
+
for (i = 1; i < NUMOFSIGNALS; i++) {
- if ((h = signal(i, SIG_DFL)) != SIG_DFL)
+ h = signal(i, SIG_DFL);
+ if (h != SIG_DFL && h != SIG_ERR)
signal(i, h);
sighandlers[i] = h;
}
@@ -108,7 +110,7 @@ extern void initsignal() {
#if HAVE_SYSV_SIGCLD
/* Ensure that SIGCLD is not SIG_IGN. Solaris's rshd does this. :-( */
h = signal(SIGCLD, SIG_DFL);
- if (h != SIG_IGN)
+ if (h != SIG_IGN && h != SIG_ERR)
signal(SIGCLD, h);
#endif
}