rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 449420e7e294e11aff835f638481fd7608778bc1
parent 09cad2440e9990cde808747f640c368124c17328
Author: tjg <tjg>
Date:   Fri, 10 Dec 1999 10:50:41 +0000

  Bug: avoid a putative race condition in signal.c

Diffstat:
MChangeLog | 1+
Msignal.c | 18+++++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -658,3 +658,4 @@ Changes since rc-1.5b2 Bug: absolute globs do still need a special case. `/*' works again now, but we still avoid creating names like `//tmp/foo'. + Bug: avoid a putative race condition in signal.c. diff --git a/signal.c b/signal.c @@ -85,19 +85,19 @@ extern void initsignal() { void (*h)(int); int i; - for (i = 1; i < NUMOFSIGNALS; i++) { - h = sys_signal(i, SIG_DFL); - if (h != SIG_DFL && h != SIG_ERR) - sys_signal(i, h); - sighandlers[i] = h; - } - #if HAVE_SYSV_SIGCLD /* Ensure that SIGCLD is not SIG_IGN. Solaris's rshd does this. :-( */ - h = sys_signal(SIGCLD, SIG_DFL); + h = sys_signal(SIGCLD, SIG_IGN); if (h != SIG_IGN && h != SIG_ERR) sys_signal(SIGCLD, h); else - sighandlers[SIGCLD] = SIG_DFL; + sys_signal(SIGCLD, SIG_DFL); #endif + + for (i = 1; i < NUMOFSIGNALS; i++) { + h = sys_signal(i, SIG_IGN); + if (h != SIG_IGN && h != SIG_ERR) + sys_signal(i, h); + sighandlers[i] = h; + } }