take2: the first patch did not restore SIG_DFL (when sigstate == 0)
--- mg.c~ Sat Mar 18 19:41:03 2000
+++ mg.c Tue Mar 28 23:36:32 2000
@@ -966,8 +966,10 @@
/* cache state so we don't fetch it again */
if(sigstate == SIG_IGN)
sv_setpv(sv,"IGNORE");
- else
- sv_setsv(sv,&PL_sv_undef);
+ else if (sigstate)
+ sv_setiv(sv,(IV)sigstate);
+ else
+ sv_setsv(sv, &PL_sv_undef);
PL_psig_ptr[i] = SvREFCNT_inc(sv);
SvTEMP_off(sv);
}
@@ -1002,6 +1004,7 @@
I32 i;
SV** svp;
STRLEN len;
+ Sighandler_t sigstate = 0;
s = MgPV(mg,len);
if (*s == '_') {
@@ -1038,16 +1041,21 @@
*svp = SvREFCNT_inc(sv);
return 0;
}
- s = SvPV_force(sv,len);
+ if (SvIOK(sv)) {
+ sigstate = (Sighandler_t)SvIVX(sv);
+ }
+ else {
+ s = SvPV_force(sv,len);
+ }
if (strEQ(s,"IGNORE")) {
if (i)
(void)rsignal(i, SIG_IGN);
else
*svp = 0;
}
- else if (strEQ(s,"DEFAULT") || !*s) {
+ else if (strEQ(s,"DEFAULT") || !*s || sigstate) {
if (i)
- (void)rsignal(i, SIG_DFL);
+ (void)rsignal(i, sigstate ? sigstate : SIG_DFL);
else
*svp = 0;
}