From: Jarkko Hietaniemi Date: Fri, 14 Mar 2003 10:30:53 +0000 (+0000) Subject: Make whichsig() to work also if some system defines X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e02bfb16cd9606a5771a9dfe520cab0ea81522e8;p=p5sagit%2Fp5-mst-13.2.git Make whichsig() to work also if some system defines zero signals (now -1 is the "not found"). Note that in couple of mg.c spots only whichsig() > 0 branches are taken because signal handlers et al don't make much sense for the zero signal. p4raw-id: //depot/perl@18975 --- diff --git a/doio.c b/doio.c index 5ac3104..091e02b 100644 --- a/doio.c +++ b/doio.c @@ -1641,10 +1641,10 @@ nothing in the core. if (mark == sp) break; s = SvPVx(*++mark, n_a); - if (isUPPER(*s)) { + if (isALPHA(*s)) { if (*s == 'S' && s[1] == 'I' && s[2] == 'G') s += 3; - if (!(val = whichsig(s))) + if ((val = whichsig(s)) < 0) Perl_croak(aTHX_ "Unrecognized signal name \"%s\"",s); } else diff --git a/mg.c b/mg.c index 98e4c09..0c37807 100644 --- a/mg.c +++ b/mg.c @@ -1075,7 +1075,7 @@ Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg) STRLEN n_a; /* Are we fetching a signal entry? */ i = whichsig(MgPV(mg,n_a)); - if (i) { + if (i > 0) { if(PL_psig_ptr[i]) sv_setsv(sv,PL_psig_ptr[i]); else { @@ -1126,7 +1126,7 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) I32 i; /* Are we clearing a signal entry? */ i = whichsig(s); - if (i) { + if (i > 0) { #ifdef HAS_SIGPROCMASK sigset_t set, save; SV* save_sv; @@ -1273,7 +1273,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) } else { i = whichsig(s); /* ...no, a brick */ - if (!i) { + if (i < 0) { if (ckWARN(WARN_SIGNAL)) Perl_warner(aTHX_ packWARN(WARN_SIGNAL), "No such signal: SIG%s", s); return 0; @@ -2439,7 +2439,7 @@ Perl_whichsig(pTHX_ char *sig) { register char **sigv; - for (sigv = PL_sig_name+1; *sigv; sigv++) + for (sigv = PL_sig_name; *sigv; sigv++) if (strEQ(sig,*sigv)) return PL_sig_num[sigv - PL_sig_name]; #ifdef SIGCLD