Permalink
Browse files

Move the csighandler to be a data variable so that

things like DLL trampolines can't mess up the code
variables the Perl_csighandler (seen in Cygwin:
Perl_csighandler in POSIX extension was different
than in main executable).

p4raw-id: //depot/perl@20565
  • Loading branch information...
1 parent ab2f3c4 commit 5c1546dc48d585e2ab2e244b01f0213280b12017 @jhi jhi committed Aug 8, 2003
Showing with 15 additions and 9 deletions.
  1. +2 −0 embedvar.h
  2. +1 −1 ext/POSIX/POSIX.xs
  3. +8 −8 mg.c
  4. +2 −0 perlapi.h
  5. +2 −0 perlvars.h
View
@@ -896,6 +896,7 @@
#define PL_No (PL_Vars.GNo)
#define PL_Yes (PL_Vars.GYes)
+#define PL_csighandlerp (PL_Vars.Gcsighandlerp)
#define PL_curinterp (PL_Vars.Gcurinterp)
#define PL_do_undump (PL_Vars.Gdo_undump)
#define PL_dollarzero_mutex (PL_Vars.Gdollarzero_mutex)
@@ -912,6 +913,7 @@
#define PL_GNo PL_No
#define PL_GYes PL_Yes
+#define PL_Gcsighandlerp PL_csighandlerp
#define PL_Gcurinterp PL_curinterp
#define PL_Gdo_undump PL_do_undump
#define PL_Gdollarzero_mutex PL_dollarzero_mutex
View
@@ -1293,7 +1293,7 @@ sigaction(sig, optaction, oldaction = 0)
/* Get back whether the old handler used safe signals. */
svp = hv_fetch(oldaction, "SAFE", 4, TRUE);
- sv_setiv(*svp, oact.sa_handler == Perl_csighandler);
+ sv_setiv(*svp, oact.sa_handler == PL_csighandlerp);
}
if (action) {
View
@@ -1144,7 +1144,7 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg)
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
sig_defaulting[i] = 1;
- (void)rsignal(i, &Perl_csighandler);
+ (void)rsignal(i, PL_csighandlerp);
#else
(void)rsignal(i, SIG_DFL);
#endif
@@ -1183,7 +1183,7 @@ Perl_csighandler(int sig)
dTHX;
#endif
#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
- (void) rsignal(sig, &Perl_csighandler);
+ (void) rsignal(sig, PL_csighandlerp);
if (sig_ignoring[sig]) return;
#endif
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
@@ -1213,7 +1213,7 @@ Perl_csighandler_init(void)
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
dTHX;
sig_defaulting[sig] = 1;
- (void) rsignal(sig, &Perl_csighandler);
+ (void) rsignal(sig, PL_csighandlerp);
#endif
#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
sig_ignoring[sig] = 0;
@@ -1306,7 +1306,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
}
if (SvTYPE(sv) == SVt_PVGV || SvROK(sv)) {
if (i) {
- (void)rsignal(i, &Perl_csighandler);
+ (void)rsignal(i, PL_csighandlerp);
#ifdef HAS_SIGPROCMASK
LEAVE;
#endif
@@ -1322,7 +1322,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
if (i) {
#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
sig_ignoring[i] = 1;
- (void)rsignal(i, &Perl_csighandler);
+ (void)rsignal(i, PL_csighandlerp);
#else
(void)rsignal(i, SIG_IGN);
#endif
@@ -1333,7 +1333,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
{
sig_defaulting[i] = 1;
- (void)rsignal(i, &Perl_csighandler);
+ (void)rsignal(i, PL_csighandlerp);
}
#else
(void)rsignal(i, SIG_DFL);
@@ -1348,7 +1348,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
if (!strchr(s,':') && !strchr(s,'\''))
sv_insert(sv, 0, 0, "main::", 6);
if (i)
- (void)rsignal(i, &Perl_csighandler);
+ (void)rsignal(i, PL_csighandlerp);
else
*svp = SvREFCNT_inc(sv);
}
@@ -2518,7 +2518,7 @@ Perl_sighandler(int sig)
#else
/* Not clear if this will work */
(void)rsignal(sig, SIG_IGN);
- (void)rsignal(sig, &Perl_csighandler);
+ (void)rsignal(sig, PL_csighandlerp);
#endif
#endif /* !PERL_MICRO */
Perl_die(aTHX_ Nullformat);
View
@@ -930,6 +930,8 @@ END_EXTERN_C
#define PL_No (*Perl_GNo_ptr(NULL))
#undef PL_Yes
#define PL_Yes (*Perl_GYes_ptr(NULL))
+#undef PL_csighandlerp
+#define PL_csighandlerp (*Perl_Gcsighandlerp_ptr(NULL))
#undef PL_curinterp
#define PL_curinterp (*Perl_Gcurinterp_ptr(NULL))
#undef PL_do_undump
View
@@ -63,3 +63,5 @@ PERLVAR(Gsigfpe_saved, Sighandler_t)
* The contents are never used, only the address. */
PERLVAR(Gsv_placeholder, SV)
+PERLVARI(Gcsighandlerp, Sighandler_t, &Perl_csighandler) /* Pointer to C-level sighandler */
+

0 comments on commit 5c1546d

Please sign in to comment.